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 kb_handler ev =
|
||||||
let x, y = !Map.player_pos in
|
let x, y = !Map.player_pos in
|
||||||
let x, y =
|
let x, y =
|
||||||
match ev |> Ev.as_type |> Ev.Keyboard.key |> Jstr.to_string with
|
match ev |> Ev.as_type |> Ev.Keyboard.code |> Jstr.to_string with
|
||||||
| "z" -> (x, y - 1)
|
| "KeyW" | "ArrowUp" -> (x, y - 1)
|
||||||
| "q" -> (x - 1, y)
|
| "KeyA" | "ArrowLeft" -> (x - 1, y)
|
||||||
| "s" -> (x, y + 1)
|
| "KeyS" | "ArrowDown" -> (x, y + 1)
|
||||||
| "d" -> (x + 1, y)
|
| "KeyD" | "ArrowRight" -> (x + 1, y)
|
||||||
| _s -> (x, y)
|
| _s -> (x, y)
|
||||||
in
|
in
|
||||||
let x = max 0 x in
|
let x = max 0 x in
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue