Mercurial > sdl-ios-xcode
comparison src/video/android/SDL_androidevents.c @ 4980:d9fdff945ec9
A bit of cleanup in the Android driver
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Wed, 12 Jan 2011 13:52:41 -0800 |
parents | 2af0032520d8 |
children | b530ef003506 |
comparison
equal
deleted
inserted
replaced
4979:be4ba07d9867 | 4980:d9fdff945ec9 |
---|---|
19 Sam Lantinga | 19 Sam Lantinga |
20 slouken@libsdl.org | 20 slouken@libsdl.org |
21 */ | 21 */ |
22 #include "SDL_config.h" | 22 #include "SDL_config.h" |
23 | 23 |
24 /* Being a null driver, there's no event stream. We just define stubs for | |
25 most of the API. */ | |
26 | |
27 #include <stdio.h> | |
28 #include <stdlib.h> | |
29 | |
30 #include "../../events/SDL_sysevents.h" | |
31 #include "../../events/SDL_events_c.h" | |
32 | |
33 #include "SDL_androidevents.h" | 24 #include "SDL_androidevents.h" |
34 | |
35 void Android_InitEvents() | |
36 { | |
37 SDLKey keymap[SDL_NUM_SCANCODES]; | |
38 | |
39 /* Add default scancode to key mapping */ | |
40 SDL_GetDefaultKeymap(keymap); | |
41 SDL_SetKeymap(0, keymap, SDL_NUM_SCANCODES); | |
42 } | |
43 | 25 |
44 void | 26 void |
45 Android_PumpEvents(_THIS) | 27 Android_PumpEvents(_THIS) |
46 { | 28 { |
47 | 29 /* No polling necessary */ |
48 //scanKeys(); | |
49 /* TODO: defer click-age */ | |
50 /* | |
51 if (keysDown() & KEY_TOUCH) { | |
52 SDL_SendMouseButton(0, SDL_PRESSED, 0); | |
53 } else if (keysUp() & KEY_TOUCH) { | |
54 SDL_SendMouseButton(0, SDL_RELEASED, 0); | |
55 } | |
56 if (keysHeld() & KEY_TOUCH) { | |
57 touchPosition t = touchReadXY(); | |
58 SDL_SendMouseMotion(0, 0, t.px, t.py, 1); | |
59 } | |
60 */ | |
61 } | |
62 | |
63 | |
64 void Android_OnResize(int width, int height, int format){ | |
65 | |
66 } | |
67 | |
68 int | |
69 Android_OnKeyDown(int keycode){ | |
70 return SDL_SendKeyboardKey(SDL_PRESSED, (SDL_scancode)keycode); | |
71 } | |
72 | |
73 int | |
74 Android_OnKeyUp(int keycode){ | |
75 return SDL_SendKeyboardKey(SDL_RELEASED, (SDL_scancode)keycode); | |
76 } | 30 } |
77 | 31 |
78 /* vi: set ts=4 sw=4 expandtab: */ | 32 /* vi: set ts=4 sw=4 expandtab: */ |