Add keys.justPressed() and keys.justReleased() handlers
- Dominant language
- Kotlin
- Stars
- 3k
- Forks
- 148
- Avg merge
- 13h 44m
- Merged PRs (30d)
- 1
Description
https://discord.com/channels/728582275884908604/728616340239417375/804141588581711943
```
keys {
var canAttack = true
down(Key.SPACE) {
if (canAttack) {
canAttack = false
attack()
}
}
up(Key.SPACE) {
canAttack = true
}
}
```
```
addUpdater {
if (views.keys.justPressed(Key.SPACE)) {
attack()
}
}
```
a new API could be:
```
keys {
justPressed(Key.SPACE) {
attack()
}
justReleased(Key.SPACE) {
idle()
}
}
```
We could also consider preventing the down event from triggering several times.
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by tracing the existing keys down and up handlers and the views.keys.justPressed usage shown in the issue. Define the desired justPressed and justReleased behavior, including whether down may fire repeatedly, and verify the API across the supported input paths.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- kotlin
- Domain
- game-dev
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 30/100