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

[Web build] Mouse can be detected outside the screen #651

Closed
iacore opened this issue Jun 13, 2023 · 3 comments
Closed

[Web build] Mouse can be detected outside the screen #651

iacore opened this issue Jun 13, 2023 · 3 comments

Comments

@iacore
Copy link

iacore commented Jun 13, 2023

Does this make sense for a console?

Peek.2023-06-13.mp4

The page is opened with w4 run ....

@iacore iacore changed the title [Web build] Mouse can be outside the screen [Web build] Mouse can be detected outside the screen Jun 13, 2023
@InterestingBrainPoops
Copy link

What would your preferred behavior be? Capping it out at zero / maximum screen size?

@iacore
Copy link
Author

iacore commented Jun 13, 2023

Depends on the game. Different games might want different behaviors.

  1. Keep events, clip to screen
  2. Drop events when it's out (pico-8)
  3. Drop events but last

3:
image

Currently wasm4 differentiate between left/middle/right mouse button. This is unlike a physical touch screen.

About simulating physical touch screen, something needed: synthetic "touch down" event when mouse leave the screen while the button is held down. and "touch up" when mouse enter the screen.

@aduros
Copy link
Owner

aduros commented Jun 20, 2023

Here's a game that heavily relies on mouse events outside of the canvas boundary: https://wasm4.org/play/future-avoid

It also happens to not be very playable on mobile because of that, but I guess that's a trade-off for game developers to decide. Maybe we can document it somewhere?

JerwuQu added a commit to JerwuQu/wasm4 that referenced this issue Apr 17, 2024
@aduros aduros closed this as completed Apr 18, 2024
JerwuQu added a commit to JerwuQu/wasm4 that referenced this issue Apr 18, 2024
JerwuQu added a commit to JerwuQu/wasm4 that referenced this issue Apr 28, 2024
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

No branches or pull requests

3 participants