Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed bug : touches become sticky #2857

Merged
merged 1 commit into from
Jan 14, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions examples/core/core_input_multitouch.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,12 @@ int main(void)
{
// Update
//----------------------------------------------------------------------------------
// Get multiple touchpoints
for (int i = 0; i < MAX_TOUCH_POINTS; ++i) touchPositions[i] = GetTouchPosition(i);
// Get the touch point count ( how many fingers are touching the screen )
int tCount = GetTouchPointCount();
// Clamp touch points available ( set the maximum touch points allowed )
if(tCount > MAX_TOUCH_POINTS) tCount = MAX_TOUCH_POINTS;
// Get touch points positions
for (int i = 0; i < tCount; ++i) touchPositions[i] = GetTouchPosition(i);
//----------------------------------------------------------------------------------

// Draw
Expand All @@ -49,7 +53,7 @@ int main(void)

ClearBackground(RAYWHITE);

for (int i = 0; i < MAX_TOUCH_POINTS; ++i)
for (int i = 0; i < tCount; ++i)
{
// Make sure point is not (0, 0) as this means there is no touch for it
if ((touchPositions[i].x > 0) && (touchPositions[i].y > 0))
Expand All @@ -72,4 +76,4 @@ int main(void)
//--------------------------------------------------------------------------------------

return 0;
}
}