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

feat(lwjgl3): split keyboard input to raw input and text input. Returns MouseDevice#getPosition #24

Merged
merged 6 commits into from
Oct 22, 2020

Conversation

DarkWeird
Copy link
Contributor

@DarkWeird DarkWeird commented Sep 2, 2020

Reintegrate changes from lwjgl3 applied to non extracted TeraNui.
See MovingBlocks/Terasology#3969

This PR breaks Mouse and Keyboard interfaces.

  • Mouse - now has an update method (for polling mouse position and calculate delta in LWJGL3 implementation).
  • Keyboard - split Keyboard events to Raw (keycodes) and Char (unicode chars) events.

@jdrueckert
Copy link
Member

LWJGL3

Copy link
Member

@skaldarnar skaldarnar left a comment

Choose a reason for hiding this comment

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

Overall looks good to me. Seemed to work fine when tested with MovingBlocks/Terasology#3969

Comment on lines +38 to +43
Vector2i getPosition();

/**
* @return The change in mouse position over the last update
*/
Vector2i getDelta();
Vector2d getDelta();
Copy link
Member

Choose a reason for hiding this comment

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

(probably unrelated to this change) Should these getters return the modifiable vectors or the constant interfaces instead?


/**
* @param button
* @return The current state of the given button
*/
boolean isButtonDown(int button);

void update();
Copy link
Member

Choose a reason for hiding this comment

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

Where does this come from? When is it called? Can we add some JavaDoc here, please?


keyboardActionQueue.add(new KeyboardAction(lastKey, ButtonState.DOWN, character));
keyboardActionQueue.add(new KeyboardAction(lastKey, ButtonState.UP, character));
keyboardCharQueue.add(new CharKeyboardAction(character));
Copy link
Member

Choose a reason for hiding this comment

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

What has changed here? Did you we do some kind of key code escaping before which is now obsolete because raw input and char input have been split up?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yeah. KeyUp and KeyDown moved into RawKeyboard.
need some investigate for LibGDX. ( nui v1.0 not used by and LibGDX's game :) )

Comment on lines +100 to +102
* Handle raw input events. Raw keys, case-independency, keyboard layout indepencency.
* Use this method for handle actions like "Press X to Win" or "Hold X key to Win"
* If you needs to fill text field, or send chat, use {@link UIWidget#onCharEvent(NUICharEvent)} instead.
Copy link
Member

Choose a reason for hiding this comment

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

👍 Thanks a lot, these comments help!

@DarkWeird DarkWeird merged commit 7f66723 into release/v1.x Oct 22, 2020
@Cervator Cervator deleted the topic/lwjgl3 branch October 24, 2020 15:11
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.

4 participants