change arrow keys (left, down, right) to letter keys (s, d, f) and arrow up to letter key 'k', because I think it is more comfortable

This commit is contained in:
2024-12-20 16:51:21 +00:00
parent 1e2ebe066f
commit aeb3756e5b
6 changed files with 42 additions and 5 deletions

View File

@@ -173,7 +173,7 @@ struct
val _ = draw shellState
val _ = Glfw.swapBuffers window
val _ = Glfw.waitEvents ()
val _ = Glfw.pollEvents ()
in
helpLoop (shellState, game)
end

View File

@@ -29,19 +29,19 @@ struct
open Input
fun handleKey (key, action) =
if key = ARROW_UP then
if key = KEY_K then
if action = PRESS then (#upHeld state) := true
else if action = RELEASE then (#upHeld state) := false
else ()
else if key = ARROW_DOWN then
else if key = KEY_D then
if action = PRESS then (#downHeld state) := true
else if action = RELEASE then (#downHeld state) := false
else ()
else if key = ARROW_LEFT then
else if key = KEY_S then
if action = PRESS then (#leftHeld state) := true
else if action = RELEASE then (#leftHeld state) := false
else ()
else if key = ARROW_RIGHT then
else if key = KEY_F then
if action = PRESS then (#rightHeld state) := true
else if action = RELEASE then (#rightHeld state) := false
else ()