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 Enter key in enum Keys #2263

Closed
yongsooim opened this issue Mar 1, 2022 · 2 comments · Fixed by #2270
Closed

Add Enter key in enum Keys #2263

yongsooim opened this issue Mar 1, 2022 · 2 comments · Fixed by #2270
Labels
bug This issue describes undesirable, incorrect, or unexpected behavior

Comments

@yongsooim
Copy link

Context

I want to test wasPressed(key: Keys) for the enter key, but there is no enum value "Enter" in enum Keys.
Without this, I have to use event method but I want the consistency with other keys.

Proposal

Add Enter key in enum Keys

@eonarheim
Copy link
Member

Hi @yongsooim,

It's definitely desirable to know when the "enter" key is/was pressed.

I'll add this to our priorities for the next release.

Did you find a workaround by chance?

@eonarheim eonarheim added the bug This issue describes undesirable, incorrect, or unexpected behavior label Mar 3, 2022
@yongsooim
Copy link
Author

yongsooim commented Mar 3, 2022

Hi @yongsooim,

It's definitely desirable to know when the "enter" key is/was pressed.

I'll add this to our priorities for the next release.

Did you find a workaround by chance?

Thank you! I used event method like this for the workaround :

let enterWasPressed = false

anActorInTheCurrentScene.onInitialize = (game) => {
  game.input.keyboard.on("press", (evt) => {
    if (evt.value == "Enter") {
      enterWasPressed = true
    }
  }
}

anActorInTheCurrentScene.update(){
  if(enterWasPressed){
      //enter pressed tested
      enterWasPressed = false
  }
}

eonarheim added a commit that referenced this issue Mar 12, 2022
…2270)

Closes #2263 

This PR adjusts the keyboard & gamepad input updates to the actual end of the frame after the `onPostUpdate` lifecycle. Additionally this adds a number of missing key codes in the `ex.Input.Keys` enum.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue describes undesirable, incorrect, or unexpected behavior
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants