13 historicalX, historicalY : LongInt; |
13 historicalX, historicalY : LongInt; |
14 timeSinceDown : Longword; |
14 timeSinceDown : Longword; |
15 end; |
15 end; |
16 |
16 |
17 procedure initModule; |
17 procedure initModule; |
18 |
|
19 |
18 |
20 procedure ProcessTouch; |
19 procedure ProcessTouch; |
21 procedure onTouchDown(x,y: Longword; pointerId: SDL_FingerId); |
20 procedure onTouchDown(x,y: Longword; pointerId: SDL_FingerId); |
22 procedure onTouchMotion(x,y: Longword; dx,dy: LongInt; pointerId: SDL_FingerId); |
21 procedure onTouchMotion(x,y: Longword; dx,dy: LongInt; pointerId: SDL_FingerId); |
23 procedure onTouchUp(x,y: Longword; pointerId: SDL_FingerId); |
22 procedure onTouchUp(x,y: Longword; pointerId: SDL_FingerId); |
24 function convertToCursor(scale: LongInt; xy: LongInt): LongInt; |
23 function convertToCursor(scale: LongInt; xy: LongInt): LongInt; |
25 function addFinger(x,y: Longword; id: SDL_FingerId): Touch_Finger; |
24 function addFinger(x,y: Longword; id: SDL_FingerId): Touch_Finger; |
26 procedure deleteFinger(id: SDL_FingerId); |
25 procedure deleteFinger(id: SDL_FingerId); |
27 procedure onTouchClick(finger: Touch_Finger); |
26 procedure onTouchClick(finger: Touch_Finger); |
|
27 procedure onTouchDoubleClick(finger: Touch_Finger); |
28 |
28 |
29 function findFinger(id: SDL_FingerId): Touch_Finger; |
29 function findFinger(id: SDL_FingerId): Touch_Finger; |
30 procedure aim(finger: Touch_Finger); |
30 procedure aim(finger: Touch_Finger); |
31 function isOnCrosshair(finger: Touch_Finger): boolean; |
31 function isOnCrosshair(finger: Touch_Finger): boolean; |
32 function isOnCurrentHog(finger: Touch_Finger): boolean; |
32 function isOnCurrentHog(finger: Touch_Finger): boolean; |
45 topButtonBoundary : LongInt; |
45 topButtonBoundary : LongInt; |
46 |
46 |
47 pointerCount : Longword; |
47 pointerCount : Longword; |
48 fingers: array of Touch_Finger; |
48 fingers: array of Touch_Finger; |
49 moveCursor : boolean; |
49 moveCursor : boolean; |
|
50 invertCursor : boolean; |
|
51 |
|
52 xTouchClick,yTouchClick : LongInt; |
|
53 timeSinceClick : Longword; |
50 |
54 |
51 //Pinch to zoom |
55 //Pinch to zoom |
52 pinchSize : hwFloat; |
56 pinchSize : hwFloat; |
53 baseZoomValue: GLFloat; |
57 baseZoomValue: GLFloat; |
54 |
58 |
55 invertCursor : boolean; |
|
56 |
59 |
57 //aiming |
60 //aiming |
58 aiming, movingCrosshair: boolean; |
61 aiming, movingCrosshair: boolean; |
59 crosshairCommand: ShortString; |
62 crosshairCommand: ShortString; |
60 targetAngle: LongInt; |
63 targetAngle: LongInt; |
61 |
|
62 stopFiring: boolean; |
64 stopFiring: boolean; |
63 |
65 |
64 //moving |
66 //moving |
65 stopLeft, stopRight, walkingLeft, walkingRight : boolean; |
67 stopLeft, stopRight, walkingLeft, walkingRight : boolean; |
66 procedure printFinger(finger: Touch_Finger); |
68 procedure printFinger(finger: Touch_Finger); |
188 ParseCommand('-right', true); |
190 ParseCommand('-right', true); |
189 walkingRight := false; |
191 walkingRight := false; |
190 end; |
192 end; |
191 end; |
193 end; |
192 |
194 |
|
195 procedure onTouchDoubleClick(finger: Touch_Finger); |
|
196 begin |
|
197 ParseCommand('ljump', true); |
|
198 end; |
|
199 |
193 procedure onTouchClick(finger: Touch_Finger); |
200 procedure onTouchClick(finger: Touch_Finger); |
194 begin |
201 begin |
|
202 if (SDL_GetTicks - timeSinceClick < 300) and (DistanceI(finger.X-xTouchClick, finger.Y-yTouchClick) < _30) then |
|
203 begin |
|
204 onTouchDoubleClick(finger); |
|
205 exit; |
|
206 end |
|
207 else |
|
208 begin |
|
209 xTouchClick := finger.x; |
|
210 yTouchClick := finger.y; |
|
211 timeSinceClick := SDL_GetTicks; |
|
212 end; |
|
213 |
195 if bShowAmmoMenu then |
214 if bShowAmmoMenu then |
196 begin |
215 begin |
197 doPut(CursorPoint.X, CursorPoint.Y, false); |
216 doPut(CursorPoint.X, CursorPoint.Y, false); |
198 exit |
217 exit |
199 end; |
218 end; |