-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinput.mli
More file actions
28 lines (23 loc) · 811 Bytes
/
input.mli
File metadata and controls
28 lines (23 loc) · 811 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
(**The abstract input type*)
type t
(**[key_input] is the type that represents the possible key to action bindings*)
type key_input =
| KMoveRight
| KMoveLeft
| KHold
| KRotateRight
| KRotateLeft
| KHardDrop
| KQuit
| KRestart
(**[init ()] is the intitial input state with key map derived from a json file*)
val init : unit -> t
(**[process_input input_state ch game_state] is the new game state following
the execution of the command binded to [ch] in [input_state]*)
val process_input : t -> string -> Game_state.t -> Game_state.t
(**[has_quit input_state] is true if the player has pressed the quit key.
False otherwise.*)
val has_quit : t -> bool
(**[get_key key_input input_state] is the char binded to [key_input] in
[input_state]*)
val get_key : key_input -> t -> char