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 something to be able to react/process keyboard's presses - readchar maybe? #146

Open
slavap opened this issue Mar 15, 2024 · 4 comments

Comments

@slavap
Copy link

slavap commented Mar 15, 2024

It is possible to control mouse movement and button clicks, but nothing like that is available for keyboard (at least I see nothing in the docs).
Then it will be possible to implement simple interactive games.

@bojidar-bg
Copy link
Contributor

bojidar-bg commented Mar 16, 2024

Just to list what other Logo-s are doing:

FMSLogo has KEYBOARDON [ onkeydown commands ] / (KEYBOARDON [ onkeydown commands ] [ onkeyup commands ]) where the commands can make use of KEYBOARDVALUE, which holds the last pressed/released key; plus KEYBOARDOFF that can disable the handler.

NetLogo has buttons which can be configured in a GUI and set to trigger when a certain keyboard key is pressed.

TerrapinLogo has READCHAR which blocks until the next character is inputted as well as KEY which works without blocking.

@slavap
Copy link
Author

slavap commented Mar 16, 2024

@bojidar-bg
It should work without blocking, KEYBOARDON looks as right thing, KEY is ok as well.

@bojidar-bg
Copy link
Contributor

KEY is most likely not what we want, as it can't handle keyup events. FMSLogo's KEYBOARDON should work nicely though, agreed.

I'd personally also love to also have something like a KEYP/KEY?/KEYDOWNP/KEYDOWN? :key, just to be able to quickly test whether a given key/keycode is currently pressed without having to setup a KEYBOARDON handler and related variables—but, oddly enough, none of the Logos I looked at had a function quite like that... 🤔

@slavap
Copy link
Author

slavap commented Mar 16, 2024

@bojidar-bg KEYP/KEY?/KEYDOWNP/KEYDOWN? :key - is quite a good idea as well and consistent with existing mouse support.

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

2 participants