MCPcopy Create free account
hub / github.com/GarageGames/Torque2D / createMouseDownEvent

Function createMouseDownEvent

engine/source/platformAndroid/AndroidInput.cpp:874–912  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

872
873
874bool createMouseDownEvent( S32 touchNumber, S32 x, S32 y, U32 numTouches )
875{
876 S32 vacantSlot = -1;
877
878 if (Canvas == NULL)
879 return false;
880
881 for( int i = 0 ; (i < MAX_TOUCH_EVENTS) && (vacantSlot == -1) ; i++ )
882 {
883 if( lastTouches[i].lastX == -1 )
884 {
885 vacantSlot = i;
886 }
887 }
888
889 if( vacantSlot == -1 )
890 return false;
891
892 ScreenTouchEvent event;
893 event.xPos = x;
894 event.yPos = y;
895 event.touchID = vacantSlot;
896 event.action = SI_MAKE;
897 event.numTouches = numTouches;
898
899 //Luma: Update position
900 Canvas->setCursorPos( Point2I( x, y ) );
901
902 if( vacantSlot != -1 )
903 {
904 lastTouches[vacantSlot].lastX = x;
905 lastTouches[vacantSlot].lastY = y;
906 }
907
908 TouchDownEvents.push_back( touchEvent( vacantSlot, x, y ) );
909 Game->postEvent(event);
910
911 return true;//return false if we get bad values or something
912}
913
914bool createMouseUpEvent( S32 touchNumber, S32 x, S32 y, S32 lastX, S32 lastY, U32 numTouches ) //EFM
915{

Callers 1

engine_handle_inputFunction · 0.85

Calls 5

touchEventClass · 0.85
Point2IClass · 0.50
setCursorPosMethod · 0.45
push_backMethod · 0.45
postEventMethod · 0.45

Tested by

no test coverage detected