Skip to content

[rcore_web]: Fix Touch pointCount reduction#4661

Merged
raysan5 merged 1 commit into
raysan5:masterfrom
maiconpintoabreu:fix-rcoreweb-touchcount-reduction
Jan 6, 2025
Merged

[rcore_web]: Fix Touch pointCount reduction#4661
raysan5 merged 1 commit into
raysan5:masterfrom
maiconpintoabreu:fix-rcoreweb-touchcount-reduction

Conversation

@maiconpintoabreu

Copy link
Copy Markdown
Contributor

Issue:

  1. Player touches position { 10, 10 } on the screen.
  • CORE.Input.Touch.pointCount = 1
  • Vector = [{10,10}]
  1. Player touches position { 100, 100 } on the screen with another finger.
  • CORE.Input.Touch.pointCount = 2
  • Vector = [{ 10, 10 } , { 100, 100 }]
  1. Player release first finger from position { 10, 10 }.
  • CORE.Input.Touch.pointCount = 1
  • Vector = [{ 10, 10 } , { 100, 100 }]
  1. When the game try to access the position 0 it gets the wrong values as the Vector is not in order.

Solution:

  1. Identify the index touch that was changed: if (touchEvent->touches[i].isChanged).
  2. Move all touch values available one position up.
  3. Reduce CORE.Input.Touch.pointCount.

@raysan5 raysan5 merged commit fc29bc2 into raysan5:master Jan 6, 2025
@raysan5

raysan5 commented Jan 6, 2025

Copy link
Copy Markdown
Owner

@maiconpintoabreu thanks for the detailed description of the problem and the provided fix!

@maiconpintoabreu maiconpintoabreu deleted the fix-rcoreweb-touchcount-reduction branch January 6, 2025 10:54
ngynkvn pushed a commit to ngynkvn/raylib that referenced this pull request Jan 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants