Key Input? #2051
-
I have been wondering what the differences are between |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 1 reply
-
Heya 👋🏻
For your method you need to use an override suspend fun SContainer.sceneMain() {
addUpdater {
println("W was just pressed: ${input.keys.justPressed(Key.W)}")
}
// Your code ( You can follow more examples here :) |
Beta Was this translation helpful? Give feedback.
-
As an alternative you can use the override suspend fun SContainer.sceneMain() {
keys {
justDown(Key.W) {
println("justDown")
}
down(Key.W) {
println("down")
}
up(Key.W) {
println("up")
}
} |
Beta Was this translation helpful? Give feedback.
-
BTW Updated the documentation with your clarifications: korlibs/docs.korge.org@823b51b#diff-21c9012ed18f4e4026df8f6bb7d576ba1bf0cd7b057be3b9207150b43f1c00bb Thanks! |
Beta Was this translation helpful? Give feedback.
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:(
addUpdater
doesn't have to be called first)You can…