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

Function createMouseMoveEvent

engine/source/platformAndroid/AndroidInput.cpp:833–871  ·  view source on GitHub ↗

we want these to only be called once per frame!!

Source from the content-addressed store, hash-verified

831
832//we want these to only be called once per frame!!
833bool createMouseMoveEvent( S32 touchNumber, S32 x, S32 y, S32 lastX, S32 lastY ) //EFM
834{
835 S32 currentSlot = -1;
836
837 if (Canvas == NULL)
838 return false;
839
840 for( int i = 0 ; (i < MAX_TOUCH_EVENTS) && (currentSlot == -1) ; i++ )
841 {
842 if( (lastX == lastTouches[i].lastX ) &&
843 (lastY == lastTouches[i].lastY ) )
844 {
845 currentSlot = i;
846 }
847 }
848
849 if( currentSlot == -1 ) return false;
850
851 ScreenTouchEvent event;
852 event.xPos = x;
853 event.yPos = y;
854 event.action = SI_MOVE;
855 event.touchID = currentSlot;
856 event.numTouches = 0;
857
858 //Luma: Mouse not moving (no hover for mouse fingers!)
859 Canvas->setCursorPos( Point2I( x, y ) );
860
861 if( currentSlot != -1 )
862 {
863 lastTouches[currentSlot].lastX = x;
864 lastTouches[currentSlot].lastY = y;
865 }
866
867 TouchMoveEvents.push_back( touchEvent( currentSlot, x, y ) );
868 Game->postEvent(event);
869
870 return true;//return false if we get bad values or something
871}
872
873
874bool createMouseDownEvent( S32 touchNumber, S32 x, S32 y, U32 numTouches )

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