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

Ion::Keyboard::Scan() don't work for a lot of physical key on simulator #1555

Open
RedGl0w opened this issue May 16, 2020 · 1 comment · May be fixed by #1616
Open

Ion::Keyboard::Scan() don't work for a lot of physical key on simulator #1555

RedGl0w opened this issue May 16, 2020 · 1 comment · May be fixed by #1616
Assignees
Milestone

Comments

@RedGl0w
Copy link
Contributor

RedGl0w commented May 16, 2020

Describe the bug

On simulator, the Ion::Keyboard::Scan() can only scan a few physical keys (

constexpr static KeySDLKeyPair sKeyPairs[] = {
KeySDLKeyPair(Ion::Keyboard::Key::Down, SDL_SCANCODE_DOWN),
KeySDLKeyPair(Ion::Keyboard::Key::Up, SDL_SCANCODE_UP),
KeySDLKeyPair(Ion::Keyboard::Key::Left, SDL_SCANCODE_LEFT),
KeySDLKeyPair(Ion::Keyboard::Key::Right, SDL_SCANCODE_RIGHT),
KeySDLKeyPair(Ion::Keyboard::Key::Shift, SDL_SCANCODE_LSHIFT),
KeySDLKeyPair(Ion::Keyboard::Key::Shift, SDL_SCANCODE_RSHIFT),
KeySDLKeyPair(Ion::Keyboard::Key::EXE, SDL_SCANCODE_RETURN),
KeySDLKeyPair(Ion::Keyboard::Key::Back, SDL_SCANCODE_ESCAPE),
KeySDLKeyPair(Ion::Keyboard::Key::Toolbox, SDL_SCANCODE_TAB),
KeySDLKeyPair(Ion::Keyboard::Key::Backspace, SDL_SCANCODE_BACKSPACE)
};
). This can be seen on workshop, when using keydown(). I think the keyboard part of Ion simulator should be refractored for using a buffer, like for the emscripten visual keys. This should also change getPlatformEvent() for only having simulator events.

If you think this is too difficult, why not just adding few physical keys, and adding in workshop the visual keyboard.

Environment

  • Epsilon master
  • The platform(s) on which the problem happens: simulator
@artaxxx artaxxx added this to the Later milestone May 28, 2020
@RedGl0w RedGl0w linked a pull request Aug 3, 2020 that will close this issue
@mobluse
Copy link

mobluse commented Feb 12, 2024

I suppose it is this file that controls what works in Python in the web simulator using ion.keydown: https://github.com/numworks/epsilon/blob/master/ion/src/simulator/shared/keyboard.cpp
Is this correct?

The simulator supports more keys when not using ion.keydown in Python: Tab (toolbox), Backspace, Enter (EXE), Shift, Alt+x (exp), Alt+v (var), Alt+e (EE), Alt+r (sqrt), Alt+p (pi), Alt+Shift+2 (**2), and the arrow keys. In Python using ion.keydown it only seems to support Tab, Enter, Shift, and the arrow keys.

I would prefer if all physical keys worked in all situations in the simulator. It would be better if there was a mapping so that all keys on the screen keyboard in the simulator could be pressed using physical keyboard keys that were easy to remember. E.g. Alt+s (sin), Alt+Shift+c (acos), Alt+n (x,n,t), Alt+a (Ans), etc.

An added advantage for teachers would be if the screen keyboard key was pressed when you press it on the physical keyboard. There would be a slight problem if you want to press '+' on a US keyboard, since you need to press Shift+=, but that would lead to that Shift key was pressed and status shift was lit, but that could be turned off as soon as '=' key was pressed, and then only the '+' key would be pressed on the screen keyboard.

Test using Anykeys:
https://my.numworks.com/python/mobluse/anykeys

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 a pull request may close this issue.

4 participants