Mercurial > sdl-ios-xcode
changeset 4670:ad4f32e874ee
Added preliminary touch code to SDL_cocoakeyboard.m
author | jimtla |
---|---|
date | Sat, 24 Jul 2010 22:28:38 +0400 |
parents | 62e6a6e9720b |
children | 1f0e8f6417d9 |
files | Xcode/SDL/SDL.xcodeproj/project.pbxproj src/video/cocoa/SDL_cocoaevents.m src/video/cocoa/SDL_cocoakeyboard.m touchTest/makefile touchTest/makefile~ |
diffstat | 5 files changed, 47 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- a/Xcode/SDL/SDL.xcodeproj/project.pbxproj Thu Jul 22 08:12:28 2010 +0400 +++ b/Xcode/SDL/SDL.xcodeproj/project.pbxproj Sat Jul 24 22:28:38 2010 +0400 @@ -874,6 +874,7 @@ 0C5AF5FD01191D2B7F000001 /* SDL_version.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = SDL_version.h; path = ../../include/SDL_version.h; sourceTree = SOURCE_ROOT; }; 0C5AF5FE01191D2B7F000001 /* SDL_video.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = SDL_video.h; path = ../../include/SDL_video.h; sourceTree = SOURCE_ROOT; }; 0C5AF5FF01191D2B7F000001 /* SDL.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = SDL.h; path = ../../include/SDL.h; sourceTree = SOURCE_ROOT; }; + 8C93F0EA11F803710014F54D /* gestureSDLTest-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "gestureSDLTest-Info.plist"; sourceTree = "<group>"; }; 8CB0A76A11F6A84800CBA2DE /* SDL_x11clipboard.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_x11clipboard.c; sourceTree = "<group>"; }; 8CB0A76B11F6A84800CBA2DE /* SDL_x11clipboard.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_x11clipboard.h; sourceTree = "<group>"; }; 8CB0A77611F6A87F00CBA2DE /* SDL_gesture.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_gesture.h; path = ../../include/SDL_gesture.h; sourceTree = SOURCE_ROOT; }; @@ -1591,6 +1592,7 @@ BECDF66B0761BA81005FE872 /* Info-Framework.plist */, BEC562FE0761C0E800A33029 /* Linked Frameworks */, 00D8D9F11195090700638393 /* testsdl-Info.plist */, + 8C93F0EA11F803710014F54D /* gestureSDLTest-Info.plist */, ); comments = "To build Universal Binaries, we have experimented with a variety of different options.\nThe complication is that we must retain compatibility with at least 10.2. \nThe Universal Binary defaults only work for > 10.3.9\n\nSo far, we have found:\ngcc 4.0.0 with Xcode 2.1 always links against libgcc_s. gcc 4.0.1 from Xcode 2.2 fixes this problem.\n\nBut gcc 4.0 will not work with < 10.3.9 because we continue to get an undefined symbol to _fprintf$LDBL128.\nSo we must use gcc 3.3 on PPC to accomplish 10.2 support. (But 4.0 is required for i386.)\n\nSetting the deployment target to 10.4 will disable prebinding, so for PPC, we set it less than 10.4 to preserve prebinding for legacy support.\n\nSetting the PPC SDKROOT to /Developers/SDKs/MacOSX10.2.8.sdk will link to 63.0.0 libSystem.B.dylib. Leaving it at current or 10.4u links to 88.1.2. However, as long as we are using gcc 3.3, it doesn't seem to matter as testing has demonstrated both will run. We have decided not to invoke the 10.2.8 SDK because it is not a default installed component with Xcode which will probably cause most people problems. However, rather than deleting the SDKROOT_ppc entry entirely, we have mapped it to 10.4u in case we decide we need to change this setting.\n\nTo use Altivec or SSE, we needed architecture specific flags:\nOTHER_CFLAGS_ppc\nOTHER_CFLAGS_i386\nOTHER_CFLAGS=$(OTHER_CFLAGS_($CURRENT_ARCH))\n\nThe general OTHER_CFLAGS needed to be manually mapped to architecture specific options because Xcode didn't do this automatically for us.\n\n\n"; name = SDLFramework;
--- a/src/video/cocoa/SDL_cocoaevents.m Thu Jul 22 08:12:28 2010 +0400 +++ b/src/video/cocoa/SDL_cocoaevents.m Sat Jul 24 22:28:38 2010 +0400 @@ -192,6 +192,9 @@ if ( event == nil ) { break; } + + //printf("Type: %i, Subtype: %i\n",[event type],[event subtype]); + switch ([event type]) { case NSLeftMouseDown: case NSOtherMouseDown: @@ -203,6 +206,7 @@ case NSRightMouseDragged: case NSOtherMouseDragged: /* usually middle mouse dragged */ case NSMouseMoved: + printf("Mouse Type: %i, Subtype: %i\n",[event type],[event subtype]); Cocoa_HandleMouseEvent(_this, event); /* Pass through to NSApp to make sure everything stays in sync */ [NSApp sendEvent:event]; @@ -217,8 +221,8 @@ if (([event modifierFlags] & NSCommandKeyMask) || [event type] == NSFlagsChanged) [NSApp sendEvent: event]; break; - case NSBeginTouch: - printf("Touch Event Received\n"); + case NSTabletPoint: + printf("Tablet Event Received\n"); default: [NSApp sendEvent:event]; break;
--- 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
--- a/touchTest/makefile Thu Jul 22 08:12:28 2010 +0400 +++ b/touchTest/makefile Sat Jul 24 22:28:38 2010 +0400 @@ -1,9 +1,6 @@ SDLTest : touchSimp.c touchPong.c gcc gestureSDLTest.c -o gestureSDLTest `sdl-config --cflags --libs` -g - gcc gestureTest.c -o gestureTest `sdl-config --cflags --libs` -g - gcc touchTest.c -o touchTest `sdl-config --cflags --libs` -g - gcc touchSimp.c -o touchSimp `sdl-config --cflags --libs` -g - gcc touchPong.c -o touchPong `sdl-config --cflags --libs` -g - gcc parseDevicesTest.c -o parseDevicesTest -g + +
--- a/touchTest/makefile~ Thu Jul 22 08:12:28 2010 +0400 +++ b/touchTest/makefile~ Sat Jul 24 22:28:38 2010 +0400 @@ -1,3 +1,9 @@ SDLTest : touchSimp.c touchPong.c - gcc touchSimp.c -o touchSimp `sdl-config --cflags --libs` -gSDLTest : + gcc gestureSDLTest.c -o gestureSDLTest `sdl-config --cflags --libs` -g + gcc gestureTest.c -o gestureTest `sdl-config --cflags --libs` -g + gcc touchTest.c -o touchTest `sdl-config --cflags --libs` -g + gcc touchSimp.c -o touchSimp `sdl-config --cflags --libs` -g gcc touchPong.c -o touchPong `sdl-config --cflags --libs` -g + gcc parseDevicesTest.c -o parseDevicesTest -g + +