Skip to content

Key Input? #2051

Closed Answered by maik-mursall
meoowe asked this question in Q&A
Nov 29, 2023 · 3 comments · 1 reply
Discussion options

You must be logged in to vote

Heya 👋🏻

justPressed -> This key has been pressed during this frame (Will only be true for the first frame this key is pressed)
justReleased -> This key has been released during this frame (Will only be true for the last frame this key is pressed / the frame the key is released)
pressing -> This key is still being pressed this frame (Will be true for every frame this key is pressed in)

For your method you need to use an Updater to be able to receive your key information every frame:

override suspend fun SContainer.sceneMain() {
    addUpdater {
        println("W was just pressed: ${input.keys.justPressed(Key.W)}")
    }
    // Your code

(addUpdater doesn't have to be called first)

You can…

Replies: 3 comments 1 reply

Comment options

You must be logged in to vote
1 reply
@meoowe
Comment options

Answer selected by meoowe
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants