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

Add keyboard and mouse events extension #1467

Merged
merged 1 commit into from
Jan 5, 2024
Merged

Conversation

riknoll
Copy link
Member

@riknoll riknoll commented Jan 5, 2024

This PR adds a browser-only extension that enables support for keyboard and mouse events.

There are two more PRs for this, one in pxt-arcade and one in pxt-arcade-sim.

The API for keyboard keys treats each key as an individual controller button. There is no "get last character typed" block because this API is not meant for typing text, just letting the player have extra button options (typing in our sim would be super cumbersome anyhow given that we have keys that map to special functions like taking a screenshot).

Also, as an added safety feature all keyboard and mouse events are disabled in mutliplayer (the code doing the disabling is in pxt-arcade-sim).

image

image

@eanders-ms
Copy link
Contributor

I see cpp additions. How does this affect the v1 hex file size? Can we regression test hex files that were at the limit before?

@eanders-ms
Copy link
Contributor

I see cpp additions. How does this affect the v1 hex file size? Can we regression test hex files that were at the limit before?

Oh I guess this isn't for microbit. nevermind!

Copy link
Contributor

@eanders-ms eanders-ms left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@riknoll riknoll merged commit f3dca2c into master Jan 5, 2024
4 checks passed
@riknoll riknoll deleted the dev/riknoll/browser-events branch January 5, 2024 17:08
@Brohann3214
Copy link

Can you add a block to show/hide the mouse pointer?

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.

3 participants