better keyboard
This commit is contained in:
parent
82dcc24eed
commit
5bbfd54efb
1 changed files with 5 additions and 5 deletions
|
|
@ -86,11 +86,11 @@ let draw_map () =
|
|||
let kb_handler ev =
|
||||
let x, y = !Map.player_pos in
|
||||
let x, y =
|
||||
match ev |> Ev.as_type |> Ev.Keyboard.key |> Jstr.to_string with
|
||||
| "z" -> (x, y - 1)
|
||||
| "q" -> (x - 1, y)
|
||||
| "s" -> (x, y + 1)
|
||||
| "d" -> (x + 1, y)
|
||||
match ev |> Ev.as_type |> Ev.Keyboard.code |> Jstr.to_string with
|
||||
| "KeyW" | "ArrowUp" -> (x, y - 1)
|
||||
| "KeyA" | "ArrowLeft" -> (x - 1, y)
|
||||
| "KeyS" | "ArrowDown" -> (x, y + 1)
|
||||
| "KeyD" | "ArrowRight" -> (x + 1, y)
|
||||
| _s -> (x, y)
|
||||
in
|
||||
let x = max 0 x in
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue