diff src/video/cocoa/SDL_cocoakeyboard.m @ 4670:ad4f32e874ee

Added preliminary touch code to SDL_cocoakeyboard.m
author jimtla
date Sat, 24 Jul 2010 22:28:38 +0400
parents 3d91e31fcf71
children 1f0e8f6417d9
line wrap: on
line diff
--- a/src/video/cocoa/SDL_cocoakeyboard.m	Thu Jul 22 08:12:28 2010 +0400
+++ b/src/video/cocoa/SDL_cocoakeyboard.m	Sat Jul 24 22:28:38 2010 +0400
@@ -31,6 +31,8 @@
 //#define DEBUG_IME NSLog
 #define DEBUG_IME
 
+#define DEBUG_TOUCH NSLog
+
 #ifndef NX_DEVICERCTLKEYMASK
     #define NX_DEVICELCTLKEYMASK    0x00000001
 #endif
@@ -191,6 +193,34 @@
     return [NSArray array];
 }
 
+// Touch Code Begins -----------
+
+- (id)initWithFrame:(CGRect)frame {
+  if (self = [super initWithFrame:frame]) {
+    [self setAcceptsTouchEvents:YES];
+    [self setWantsRestingTouches:YES];
+    DEBUG_TOUCH(@"Initializing Cocoa Touch System....");
+    //DEBUG_TOUCH(@"Accepts Touch events? %@",[self acceptsTouchEvents]);
+  }
+  return self;
+}
+
+- (void)touchesBeganWithEvent:(NSEvent *)event {
+  DEBUG_TOUCH(@"Finger Down");
+}
+- (void)touchesMovedWithEvent:(NSEvent *)event {
+  DEBUG_TOUCH(@"Finger Moved");
+}
+- (void)touchesEndedWithEvent:(NSEvent *)event {
+  DEBUG_TOUCH(@"Finger Up");
+}
+- (void)touchesCancelledWithEvent:(NSEvent *)event {
+  DEBUG_TOUCH(@"Finger Cancelled");
+}
+
+//Touch Code Ends --------------
+
+
 @end
 
 /* This is the original behavior, before support was added for