Mercurial > sdl-ios-xcode
comparison src/touchscreen/nds/SDL_systouchscreen.c @ 2675:5e4274591163 gsoc2008_nds
Started minor changes to the coordinate system used by the touchscreen API as discussed on the mailing list. Also beginning to separate the 'Pressed' and 'Moved' event handling on the private level.
author | Darren Alton <dalton@stevens.edu> |
---|---|
date | Sun, 29 Jun 2008 21:32:31 +0000 |
parents | f1d07ba2e275 |
children | 082cc3ffd7d8 |
comparison
equal
deleted
inserted
replaced
2674:f1d07ba2e275 | 2675:5e4274591163 |
---|---|
80 */ | 80 */ |
81 void | 81 void |
82 SDL_SYS_TouchscreenUpdate(SDL_Touchscreen * touchscreen) | 82 SDL_SYS_TouchscreenUpdate(SDL_Touchscreen * touchscreen) |
83 { | 83 { |
84 u32 keysd, keysu, keysh; | 84 u32 keysd, keysu, keysh; |
85 int xpos, ypos, pressure = 16384; | 85 Uint16 xpos=0, ypos=0, pressure = 32767; |
86 touchPosition touch; | 86 touchPosition touch; |
87 | 87 |
88 scanKeys(); | 88 scanKeys(); |
89 keysd = keysDown(); | 89 keysd = keysDown(); |
90 keysh = keysHeld(); | 90 keysh = keysHeld(); |
91 keysu = keysUp(); | 91 keysu = keysUp(); |
92 touch=touchReadXY(); | 92 touch=touchReadXY(); |
93 xpos = (touch.px-128)*256; | 93 xpos = (touch.px << 8) + 1; |
94 ypos = (touch.py-96)*(65536/192); | 94 ypos = (touch.py << 16) / 192 + 1; |
95 /* TODO uses touch.x and touch.y for something. | |
96 we discussed in the mailing list having both "hardware x/y" and | |
97 "screen x/y" coordinates. */ | |
95 | 98 |
96 if (((keysd|keysh) & KEY_TOUCH)) { | 99 if ((keysd & KEY_TOUCH)) { |
97 SDL_PrivateTouchPress(touchscreen, 0, xpos, ypos, pressure); | 100 SDL_PrivateTouchPress(touchscreen, 0, xpos, ypos, pressure); |
101 } | |
102 if ((keysh & KEY_TOUCH)) { | |
103 SDL_PrivateTouchMove(touchscreen, 0, xpos, ypos, pressure); | |
98 } | 104 } |
99 if ((keysu & KEY_TOUCH)) { | 105 if ((keysu & KEY_TOUCH)) { |
100 SDL_PrivateTouchRelease(touchscreen, 0); | 106 SDL_PrivateTouchRelease(touchscreen, 0); |
101 } | 107 } |
102 } | 108 } |