Module type P5.Core.Sketch

module type Sketch = Sketch.Sketch

type state 

The type of the state, used for all information stored between frames.

module R: Renderer.Renderer 
val display : Renderer.display

The type of the display, e.g. `Size (400, 400).

Main Functions

val setup : Config.config -> state

setup config is the initial state.

val loop : Config.config -> state -> state

loop config state is the state that results after advancing state through one time step.

val draw : Config.config -> state -> Shape.t

draw config state is the shape that should be drawn in the given state.

Mouse Event Functions

val mouse_pressed : Config.config -> state -> state

mouse_pressed config state is the state that results after the mouse is pressed in state. Mouse information can be obtained from config.

val mouse_released : Config.config -> state -> state

mouse_released config state is the state results after the mouse is released in state. Mouse information can be obtained from config.

val mouse_moved : Config.config -> state -> state

mouse_moved config state is the state that results after the mouse is moved in state. Mouse information can be obtained from config.

val mouse_dragged : Config.config -> state -> state

mouse_dragged config state is the state that results after the mouse is dragged (moved while pressed) in state. Mouse information can be obtained from config.

val mouse_clicked : Config.config -> state -> state

mouse_clicked config state is the state that results after the mouse is clicked (pressed and then released) in state. Mouse information can be obtained from config.

val mouse_scrolled : Config.config -> state -> state

mouse_scrolled config state is the state that results after the mouse is scrolled in state. Mouse information can be obtained from config.

Key Event Functions

val key_pressed : Config.config -> state -> state

key_pressed config state is the state that results after a key is pressed in state. Key information can be obtained from config.

val key_released : Config.config -> state -> state

key_released config state is the state that results after a key is released in state. Key information can be obtained from config.

val key_typed : Config.config -> state -> state

key_typed config state is the state that results after a key is typed (pressed and released) in state. Key information can be obtained from config.

Window State Event Functions

val window_resized : Config.config -> state -> state

window_resized config state is the state that results after the window is resized in state. Window information can be obtained from config.

val window_closed : Config.config -> state -> state

window_closed config state is the state that results after the window is closed in state. Window information can be obtained from config. The default action is to raise Exit.