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

mrms: Some actions work only in the event handler callback #128

Open
marekmaskarinec opened this issue Jan 14, 2024 · 0 comments
Open

mrms: Some actions work only in the event handler callback #128

marekmaskarinec opened this issue Jan 14, 2024 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@marekmaskarinec
Copy link
Member

Original issue:

~mrms/tophat#19

Initial message:

[11:16] ske: btw one thing tophat may have a problem with is that javascript expects you to process key events in the event handler

[11:16] ske: so for example if you have ctrl+f set to go fullscreen and you coded it like this:

[11:17] ske:

if input.isPressed(input.key_ctrl) && input.isJustPressedc('f') {
  // go fullscreen
}

[11:17] ske: it won't go fullscreen because it's not in the event handler

[11:17] ske: this applies to some operations

[11:18] ske: playing sounds, going on and off the fullscreen, showing file dialogs among others

[11:19] ske: the only way to fix that I can see is to have a button shown that says "click me" to activate certain action

[11:19] ske: but thats eh

ske

a decent solution would have an onEvent callback, like onFrame. It won't replace the default input scheme, it will just complement it. In the event callback people will be able to do the same check

if input.isPressed(input.key_ctrl) && input.isJustPressedc('f') {
  // go fullscreen
}

and it will go fullscreen indeed.

@marekmaskarinec marekmaskarinec added the bug Something isn't working label Jan 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants