-
Notifications
You must be signed in to change notification settings - Fork 43
Callbacks
:update [[delta time] state]
Called every time a frame is rendered. delta
is the elapsed time, in seconds, since :update
was last called. time
is the elapsed time, in seconds, since the application started running.
:display [[delta time] state]
Called every time a frame is rendered. Return values from :display
are ignored.
:init [state]
Called once, when application begins.
:close [state]
Called once, when application ends.
:reshape [[x y width height] state]
Called when application begins, and every subsequent time the window is resized.
:mouse-drag [[dx dy] [x y] button state]
Called when mouse moves with a button pressed. [dx dy]
contains relative motion since last time :mouse-drag
was called, and [x y]
contains absolute position of the mouse. button
will be equal to one of :left
, :right
, :center
, :mouse-4
, or :mouse-5
. If the mouse is moving when two or more buttons are pressed, :mouse-drag
will be called once for each button.
:mouse-move [[dx dy] [x y] state]
Same as :mouse-drag
, but when no button is pressed.
:mouse-down [[x y] button state]
Called whenever a button is pressed.
:mouse-up [[x y] button state]
Called whenever a button is released.
:mouse-click [[x y] button state]
Called whenever a mouse is clicked (pressed and released). Gives [x y]
of where mouse was originally pressed.
:key-press [key state]
Called whenever a key is pressed. If the key is something that would normally show up in a text entry field, key
is a case-sensitive string. Examples include “a”, “&”, and " ". If it is not, key
is a keyword. Examples include :left
, :control
, and :escape
:key-release [key state]
Called whenever a key is released.
:key-type [key state]
Called whenever a key is pressed and released. This is the only key event which will expose auto-repeated keys.