Updated Touch events, now one can check for pressed and released Touches same as you check for Mouse Buttons...
This commit is contained in:
parent
2a2f2b20b8
commit
a1d7b3427a
|
|
@ -1136,6 +1136,10 @@ RLAPI int GetTouchY(void); // Get touch posit
|
||||||
RLAPI Vector2 GetTouchPosition(int index); // Get touch position XY for a touch point index (relative to screen size)
|
RLAPI Vector2 GetTouchPosition(int index); // Get touch position XY for a touch point index (relative to screen size)
|
||||||
RLAPI int GetTouchPointId(int index); // Get touch point identifier for given index
|
RLAPI int GetTouchPointId(int index); // Get touch point identifier for given index
|
||||||
RLAPI int GetTouchPointCount(void); // Get number of touch points
|
RLAPI int GetTouchPointCount(void); // Get number of touch points
|
||||||
|
bool IsTouchPointPressed(int index); // Check if a Touch point is pressed once (if the finger touch got in contact with the the screen once, a.k.a TAP, also found in gestures)
|
||||||
|
bool IsTouchPointReleased(int index); // Check if a Touch point has been released once (if the finger touch was in contact with the screen and now is not anymore)
|
||||||
|
bool IsTouchPointDown(int index); // Check if a Touch Point is being pressed (if the finger touch is in contact with the screen)
|
||||||
|
bool IsTouchPointUp(int index); // Check if a Touch Point was released (if the finger touch no longer in contact with the screen)
|
||||||
|
|
||||||
//------------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------------
|
||||||
// Gestures and Touch Handling Functions (Module: rgestures)
|
// Gestures and Touch Handling Functions (Module: rgestures)
|
||||||
|
|
|
||||||
34
src/rcore.c
34
src/rcore.c
|
|
@ -3907,6 +3907,40 @@ int GetTouchPointCount(void)
|
||||||
return CORE.Input.Touch.pointCount;
|
return CORE.Input.Touch.pointCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Check if a Touch point is pressed once (if the finger touch got in contact with the the screen once, a.k.a TAP, also found in gestures)
|
||||||
|
bool IsTouchPointPressed(int index)
|
||||||
|
{
|
||||||
|
// Compare the previous and current Touch point state
|
||||||
|
if ((CORE.Input.Touch.currentTouchState[index] == 1) && (CORE.Input.Touch.previousTouchState[index] == 0)) return true;
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check if a Touch point has been released once (if the finger touch was in contact with the screen and now is not anymore)
|
||||||
|
bool IsTouchPointReleased(int index)
|
||||||
|
{
|
||||||
|
// Compare the previous and current Touch point state
|
||||||
|
if ((CORE.Input.Touch.currentTouchState[index] == 0) && (CORE.Input.Touch.previousTouchState[index] == 1)) return true;
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check if a Touch Point is being pressed (if the finger touch is in contact with the screen)
|
||||||
|
bool IsTouchPointDown(int index)
|
||||||
|
{
|
||||||
|
// Get the state of the Touch point
|
||||||
|
if (CORE.Input.Touch.currentTouchState[index] == 1) return true;
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check if a Touch Point was released (if the finger touch no longer in contact with the screen)
|
||||||
|
bool IsTouchPointUp(int index)
|
||||||
|
{
|
||||||
|
// Reverse the state of the IsTouchPointDown() function
|
||||||
|
return !IsTouchPointDown(index);
|
||||||
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
// Module specific Functions Definition
|
// Module specific Functions Definition
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user