module World: sig .. end
type ('a, 'b) t =
| |
World of 'a |
| |
Package of 'a * 'b |
val big_bang : ?name:string ->
?width:int ->
?height:int ->
?to_draw:('a -> Image.t) ->
?on_tick:('a -> ('a, 'b) t) ->
?on_mouse:('a -> float -> float -> string -> ('a, 'c) t) ->
?on_key_press:('a -> string -> ('a, 'd) t) ->
?on_key_release:('a -> string -> ('a, 'e) t) ->
?rate:float ->
?stop_when:('a -> bool) ->
?to_draw_last:('a -> Image.t) ->
?register:string * string ->
?on_receive:('a -> 'f -> ('a, 'g) t) -> 'a -> unit
starts a game after receiving the following arguments
(the last argument of type
'a is mandatory)
name : a name appearing at the top of a window
width height : width and height of a window
to_draw : receives a world;
returns an image to be drawn on a window
on_tick : receives a world; returns a world after 1 tick
on_mouse : receives a world, a mouse coordinate, and a name of a
mouse event; returns a new world
on_key_press : receives a world and a name of a pressed key;
returns a new world
on_key_release : receives a world and a name of a released key;
returns a new world
rate : an interval of 1 tick in sec
stop_when : receives a world;
returns true if the game is over
to_draw_last : receives a world;
returns an image to be drawn when the game is over
register : the ip address and the port number of a server
on_receive : receives a world and a message sent from the server;
returns a new world
- an initial value of
world (mandatory)