SDLApp

copy

instantiate

(Fn [(Ref SDLApp a)] SDLApp)

copies a SDLApp.

create

defn

(Fn [(Ref String a), Int, Int] SDLApp)

                        (create title width height)
                    

creates an SDLApp instance that can then be used by run-with-callbacks.

default-draw

defn

(Fn [a, (Ptr SDL_Renderer), b] ())

                        (default-draw app rend state-ref)
                    

is a default rendering function that can be passed to run-with-callbacks.

delete

instantiate

(Fn [SDLApp] ())

deletes a SDLApp. Should usually not be called manually.

fps

instantiate

(Fn [(Ref SDLApp a)] (Ref Int a))

gets the fps property of a SDLApp.

init

instantiate

(Fn [(Ptr SDL_Window), (Ptr SDL_Renderer), Int] SDLApp)

creates a SDLApp.

prn

instantiate

(Fn [(Ref SDLApp a)] String)

converts a SDLApp to a string.

quit-on-esc

defn

(Fn [(Ref SDLApp a), b, (Ref SDL_Event c)] b)

                        (quit-on-esc app state event)
                    

is a default event handling function that can be passed to run-with-callbacks. Allows the application to quit if the player presses the escape key.

renderer

instantiate

(Fn [(Ref SDLApp a)] (Ref (Ptr SDL_Renderer) a))

gets the renderer property of a SDLApp.

run-with-callbacks

defn

(Fn [(Ref SDLApp a), (Fn [(Ref SDLApp a), b, (Ref SDL_Event c)] b d), (Fn [b] b e), (Fn [(Ref SDLApp a), (Ptr SDL_Renderer), (Ref b f)] () e), b] ())

                        (run-with-callbacks app event-fn update-fn draw-fn initial-state)
                    

starts the SDLApp and uses three callbacks to handle events, update state and render graphics.

set-fps

instantiate

(Fn [SDLApp, Int] SDLApp)

sets the fps property of a SDLApp.

set-fps!

instantiate

(Fn [(Ref SDLApp a), Int] ())

sets the fps property of a SDLApp in place.

set-renderer

instantiate

(Fn [SDLApp, (Ptr SDL_Renderer)] SDLApp)

sets the renderer property of a SDLApp.

set-renderer!

instantiate

(Fn [(Ref SDLApp a), (Ptr SDL_Renderer)] ())

sets the renderer property of a SDLApp in place.

set-window

instantiate

(Fn [SDLApp, (Ptr SDL_Window)] SDLApp)

sets the window property of a SDLApp.

set-window!

instantiate

(Fn [(Ref SDLApp a), (Ptr SDL_Window)] ())

sets the window property of a SDLApp in place.

stop

defn

(Fn [(Ref SDLApp a)] b)

                        (stop app)
                    

stops the app. This function return 'a' to enable it to be called from anywhere.

str

instantiate

(Fn [(Ref SDLApp a)] String)

converts a SDLApp to a string.

update-fps

instantiate

(Fn [SDLApp, (Ref (Fn [Int] Int a) b)] SDLApp)

updates the fps property of a SDLApp using a function f.

update-renderer

instantiate

(Fn [SDLApp, (Ref (Fn [(Ptr SDL_Renderer)] (Ptr SDL_Renderer) a) b)] SDLApp)

updates the renderer property of a SDLApp using a function f.

update-window

instantiate

(Fn [SDLApp, (Ref (Fn [(Ptr SDL_Window)] (Ptr SDL_Window) a) b)] SDLApp)

updates the window property of a SDLApp using a function f.

window

instantiate

(Fn [(Ref SDLApp a)] (Ref (Ptr SDL_Window) a))

gets the window property of a SDLApp.