Raylib

Program state err

Provide an initial state and a render function to the platform.

{
    init : Task state {},
    render : state -> Task state {},
}

PlatformState

KeyboardKey

MouseButton

Rectangle

Represents a rectangle.

{ x : F32, y : F32, width : F32, height : F32 }

Vector2

Represents a 2D vector.

{ x : F32, y : F32 }

Color

Represents a color.

{ r : U8, g : U8, b : U8, a : U8 }

rgba : Color -> { r : U8, g : U8, b : U8, a : U8 }

exit : Task {} *

Exit the program.

log : Str, [ LogAll, LogTrace, LogDebug, LogInfo, LogWarning, LogError, LogFatal, LogNone ] -> Task {} *

Show a Raylib log trace message.

Raylib.log! "Not yet implemented" LogError

setWindowTitle : Str -> Task {} *

Set the window title.

setWindowSize : { width : F32, height : F32 } -> Task {} *

Set the window size.

getScreenSize : Task { height : F32, width : F32 } *

Get the window size.

setTargetFPS : I32 -> Task {} *

Set the target frames per second. The default value is 60.

setDrawFPS : { fps : [ Visible, Hidden ], posX ? I32, posY ? I32 } -> Task {} *

Display the frames per second, and set the location. The default values are Hidden, 10, 10.

Raylib.setDrawFPS! { fps: Visible, posX: 10, posY: 10 }

setBackgroundColor : Color -> Task {} *

Set the background color to clear the window between each frame.

measureText : { text : Str, size : I32 } -> Task I64 *

Measure the width of a text string using the default font.

drawText : { text : Str, x : F32, y : F32, size : I32, color : Color } -> Task {} *

Draw text on the screen using the default font.

drawLine : { start : Vector2, end : Vector2, color : Color } -> Task {} *

Draw a line on the screen.

drawRectangle : { x : F32, y : F32, width : F32, height : F32, color : Color } -> Task {} *

Draw a rectangle on the screen.

drawRectangleGradient : { x : F32, y : F32, width : F32, height : F32, top : Color, bottom : Color } -> Task {} *

Draw a rectangle with a gradient on the screen.

drawCircle : { x : F32, y : F32, radius : F32, color : Color } -> Task {} *

Draw a circle on the screen.

drawCircleGradient : { x : F32, y : F32, radius : F32, inner : Color, outer : Color } -> Task {} *

Draw a circle with a gradient on the screen.

takeScreenshot : Str -> Task {} *

Takes a screenshot of current screen (filename extension defines format)

Raylib.takeScreenshot! "screenshot.png"

Camera

createCamera : { target : Vector2, offset : Vector2, rotation : F32, zoom : F32 } -> Task Camera *

updateCamera : Camera, { target : Vector2, offset : Vector2, rotation : F32, zoom : F32 } -> Task {} *

drawMode2D : Camera, Task {} err -> Task {} err