changeset 7278 | 000e4543f204 |
parent 7246 | 7773a1c92e1b |
child 7850 | fcbb024090a4 |
7238:313b2ecc4441 | 7278:000e4543f204 |
---|---|
20 |
20 |
21 unit uTouch; |
21 unit uTouch; |
22 |
22 |
23 interface |
23 interface |
24 |
24 |
25 uses SysUtils, uConsole, uVariables, SDLh, uFloat, uConsts, uCommands, uIO, GLUnit, uTypes, uCaptions, uAmmos, uWorld; |
25 uses SysUtils, uConsole, uVariables, SDLh, uFloat, uConsts, uCommands, uIO, GLUnit, uTypes, uCaptions, uAmmos, uWorld, uMobile; |
26 |
26 |
27 |
27 |
28 procedure initModule; |
28 procedure initModule; |
29 |
29 |
30 procedure ProcessTouch; |
30 procedure ProcessTouch; |
555 y := 0; |
555 y := 0; |
556 convertToFingerCoord(x, y, CrosshairX, CrosshairY); |
556 convertToFingerCoord(x, y, CrosshairX, CrosshairY); |
557 isOnCrosshair:= isOnRect((x-HalfRectSize), (y-HalfRectSize), RectSize, RectSize, finger); |
557 isOnCrosshair:= isOnRect((x-HalfRectSize), (y-HalfRectSize), RectSize, RectSize, finger); |
558 printFinger(finger); |
558 printFinger(finger); |
559 WriteLnToConsole(inttostr(finger.x) + ' ' + inttostr(x)); |
559 WriteLnToConsole(inttostr(finger.x) + ' ' + inttostr(x)); |
560 WriteLnToConsole(inttostr(x) + ' ' + inttostr(y) + ' ' + inttostr(round(Android_JNI_getDensity() * 10))); |
560 WriteLnToConsole(inttostr(x) + ' ' + inttostr(y) + ' ' + inttostr(round(uMobile.getScreenDPI * 10))); |
561 end; |
561 end; |
562 |
562 |
563 function isOnCurrentHog(finger: TTouch_Data): boolean; |
563 function isOnCurrentHog(finger: TTouch_Data): boolean; |
564 var |
564 var |
565 x,y : LongInt; |
565 x,y : LongInt; |
630 |
630 |
631 procedure initModule; |
631 procedure initModule; |
632 var |
632 var |
633 index: Longword; |
633 index: Longword; |
634 //uRenderCoordScaleX, uRenderCoordScaleY: Longword; |
634 //uRenderCoordScaleX, uRenderCoordScaleY: Longword; |
635 density: Single; |
|
636 begin |
635 begin |
637 buttonsDown:= 0; |
636 buttonsDown:= 0; |
638 |
637 |
639 setLength(fingers, 4); |
638 setLength(fingers, 4); |
640 for index := 0 to High(fingers) do |
639 for index := 0 to High(fingers) do |
641 fingers[index].id := nilFingerId; |
640 fingers[index].id := nilFingerId; |
642 |
641 |
643 {$IFDEF ANDROID} |
642 rectSize:= round(baseRectSize * uMobile.getScreenDPI); |
644 density:= Android_JNI_getDensity(); |
|
645 {$ELSE} |
|
646 density:= 1.0; |
|
647 {$ENDIF} |
|
648 |
|
649 rectSize:= round(baseRectSize * density); |
|
650 halfRectSize:= rectSize shl 1; |
643 halfRectSize:= rectSize shl 1; |
651 end; |
644 end; |
652 |
645 |
653 begin |
646 begin |
654 end. |
647 end. |