Skip to content

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

Merged
DarkWeird merged 6 commits into
release/v1.xfrom
topic/lwjgl3
Oct 22, 2020
Merged

feat(lwjgl3): split keyboard input to raw input and text input. Returns MouseDevice#getPosition#24
DarkWeird merged 6 commits into
release/v1.xfrom
topic/lwjgl3

Conversation

@DarkWeird
Copy link
Copy Markdown
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
Copy Markdown
Member

LWJGL3

Copy link
Copy Markdown
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
Copy Markdown
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?

*/
boolean isButtonDown(int button);

void update();
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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