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

Make raylib/raygui work better on touchscreen #3728

Merged
merged 3 commits into from
Jan 20, 2024
Merged

Conversation

casavaca
Copy link
Contributor

Hi,

I'm trying raylib on my iPad using emscripten. I found that raylib and raygui don't work well. We need updated mouse position yet it's never updated (always 0,0). As a result, Cubic-bezier lines doesn't work on iPad.

I don't fully understand how it works on desktop browser, but it may be reasonable to update mouse position of we are using touch screen?

This is not pretty, but after this fix, raylib and raygui work just fine.
If you have better fix, then it's great. Just kindly discard this pull request.

@ghost
Copy link

ghost commented Jan 13, 2024

As a result, Cubic-bezier lines doesn't work on iPad.

I don't think all examples were designed with the touch API in mind, which has its own set of functions (L1191-L1196, L1201-L1208) and its own handling.

but it may be reasonable to update mouse position of we are using touch screen?

That assumes mouse and touch should be integrated, which may or may not be the case.

That being said, I think this PR is ok and probably shouldn't cause any major issues. Touches will override mouse position, but any mouse movement will fix that if it happens.

Edit: These comments (R1639-R1641) are probably unnecessary. Also, please mind the coding conventions.


Footnote: just beware that, right now, mouse input and touch input are different things, so YMMV. When I rewrote the input code for my kernel, I've integrated both in a single API, but it required a considerable architectural change. Mouse and touch require very different handling and making both work interchangeably reliably is complicated.

@casavaca
Copy link
Contributor Author

I see. I've updated the comments.

@casavaca
Copy link
Contributor Author

Bump

@raysan5 raysan5 merged commit 0a8165c into raysan5:master Jan 20, 2024
14 checks passed
@raysan5
Copy link
Owner

raysan5 commented Jan 20, 2024

@casavaca Thanks for the review. Checking the code it shouldn't be a problem to just map it... let's see...

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