Module input is responsible for handling all low level input releted
things. Input ands following commans to parser:
input mode type.
An input mode is the state in which the game is. All input is processed
according to this mode. Eg when the player has openede the menu all input
is directed to the menu. It can also be used in games, eg when the player
is in the shop other keybindings are active.
Exception Quit is raised when the player has requested quit either by
pressing Ctrl-C, trying to close the window, or by non-fatal signal
val add_mode :
?super:bool -> string -> (Sdlevent.event -> unit) -> mode
add_mode name handle_event_fun creates new mode named
which events are handled by
handle_event_fun. If the mode is a super
mode it can be set by the user and afterwards the user may cancel it
val set_mode :
mode -> unit
set_mode m sets current mode to m
val process_events :
?events_per_frame:int -> unit -> bool
process_events ?n () processes at most
n events from a buffer.
optional. It returns if anything has happened.
val add_action :
?mode:mode -> string -> (int -> unit) -> (int -> unit) -> unit
add_action ?mode action_name start_fun end_fun adds an action to the
console (allows binding it). When a local player does "bind_action
key_name action_name n" on the console then after pressing
start_fun will be called with param
n. It allows you to use one action
for several players.
mode : is an optional parameter which decides in which mode the action
should be active. If not given the action is added to current mode.
val get_real_mode :
unit -> mode
Returns current privileged mode or mode if none is set
val set_repeat_handler :
(unit -> bool) option -> unit
Internal. Sets the callback for event repeating