raylib

Raylib game development library bindings for Kit

Files

FileDescription
.editorconfigEditor formatting configuration
.gitignoreGit ignore rules for build artifacts and dependencies
.tool-versionsasdf tool versions (Zig, Kit)
LICENSEMIT license file
README.mdThis file
c/kit_raylib.cC FFI wrapper
c/kit_raylib.hC header for FFI wrapper
check-examples.kitcheck-examples.kit
examples/audio/music-controls.kitExample: music controls
examples/audio/music-pitch.kitExample: music pitch
examples/audio/music-stream.kitExample: music stream
examples/audio/resources/country.mp3country.mp3
examples/audio/resources/sound.wavsound.wav
examples/audio/resources/target.oggtarget.ogg
examples/audio/sound-effects.kitExample: sound effects
examples/audio/sound-loading.kitExample: sound loading
examples/audio/sound-multi.kitExample: sound multi
examples/audio/sound-pan.kitExample: sound pan
examples/audio/sound-pitch.kitExample: sound pitch
examples/audio/sound-volume.kitExample: sound volume
examples/core/2d-camera-mouse-zoom.kitExample: 2d camera mouse zoom
examples/core/2d-camera-platformer.kitExample: 2d camera platformer
examples/core/2d-camera-zoom.kitExample: 2d camera zoom
examples/core/2d-camera.kitExample: 2d camera
examples/core/3d-camera-first-person.kitExample: 3d camera first person
examples/core/3d-camera-free.kitExample: 3d camera free
examples/core/3d-camera-mode.kitExample: 3d camera mode
examples/core/3d-picking.kitExample: 3d picking
examples/core/basic-screen-manager.kitExample: basic screen manager
examples/core/basic-window.kitExample: basic window
examples/core/bouncing-ball.kitExample: bouncing ball
examples/core/clipboard-text.kitExample: clipboard text
examples/core/delta-time.kitExample: delta time
examples/core/draw-ring.kitExample: draw ring
examples/core/drop-files.kitExample: drop files
examples/core/fps-counter.kitExample: fps counter
examples/core/fullscreen-toggle.kitExample: fullscreen toggle
examples/core/input-gamepad.kitExample: input gamepad
examples/core/input-gestures.kitExample: input gestures
examples/core/input-keys-detect.kitExample: input keys detect
examples/core/input-keys.kitExample: input keys
examples/core/input-mouse-wheel.kitExample: input mouse wheel
examples/core/input-mouse.kitExample: input mouse
examples/core/input-multitouch.kitExample: input multitouch
examples/core/keyboard-input.kitExample: keyboard input
examples/core/mouse-input.kitExample: mouse input
examples/core/mouse-zoom.kitExample: mouse zoom
examples/core/multi-touch.kitExample: multi touch
examples/core/random-values.kitExample: random values
examples/core/render-texture.kitExample: render texture
examples/core/scissor-test.kitExample: scissor test
examples/core/smooth-movement.kitExample: smooth movement
examples/core/smooth-pixel-perfect.kitExample: smooth pixel perfect
examples/core/split-screen.kitExample: split screen
examples/core/timing.kitExample: timing
examples/core/window-events.kitExample: window events
examples/core/window-flags.kitExample: window flags
examples/core/window-letterbox.kitExample: window letterbox
examples/core/window-resize.kitExample: window resize
examples/core/window-should-close.kitExample: window should close
examples/core/world-screen.kitExample: world screen
examples/models/3d-shapes.kitExample: 3d shapes
examples/models/billboard.kitExample: billboard
examples/models/bounding-box.kitExample: bounding box
examples/models/camera-controls.kitExample: camera controls
examples/models/cone-mesh.kitExample: cone mesh
examples/models/cubicmap.kitExample: cubicmap
examples/models/cylinders-cones.kitExample: cylinders cones
examples/models/first-person-camera.kitExample: first person camera
examples/models/geometric-shapes.kitExample: geometric shapes
examples/models/heightmap-terrain.kitExample: heightmap terrain
examples/models/hemisphere.kitExample: hemisphere
examples/models/lines-3d.kitExample: lines 3d
examples/models/mesh-generation.kitExample: mesh generation
examples/models/model-transform.kitExample: model transform
examples/models/model-wireframe.kitExample: model wireframe
examples/models/multi-mesh.kitExample: multi mesh
examples/models/orbital-camera.kitExample: orbital camera
examples/models/plane-mesh.kitExample: plane mesh
examples/models/polygon-mesh.kitExample: polygon mesh
examples/models/spheres-demo.kitExample: spheres demo
examples/models/third-person-camera.kitExample: third person camera
examples/models/torus-knot.kitExample: torus knot
examples/others/easings-testbed.kitExample: easings testbed
examples/others/hello.kitExample: hello
examples/others/input.kitExample: input
examples/others/minimal-test.kitExample: minimal test
examples/others/pong.kitExample: pong
examples/others/trace-log-test.kitExample: trace log test
examples/shaders/basic-shader.kitExample: basic shader
examples/shaders/bloom.kitExample: bloom
examples/shaders/blur.kitExample: blur
examples/shaders/chromatic-aberration.kitExample: chromatic aberration
examples/shaders/circle-gradient.kitExample: circle gradient
examples/shaders/color-grading.kitExample: color grading
examples/shaders/color-invert.kitExample: color invert
examples/shaders/crosshatch.kitExample: crosshatch
examples/shaders/crt.kitExample: crt
examples/shaders/dithering.kitExample: dithering
examples/shaders/edge-detect.kitExample: edge detect
examples/shaders/emboss.kitExample: emboss
examples/shaders/fisheye.kitExample: fisheye
examples/shaders/glitch.kitExample: glitch
examples/shaders/julia-set.kitExample: julia set
examples/shaders/mandelbrot.kitExample: mandelbrot
examples/shaders/noise.kitExample: noise
examples/shaders/palette-switch.kitExample: palette switch
examples/shaders/pixelizer.kitExample: pixelizer
examples/shaders/plasma.kitExample: plasma
examples/shaders/posterize.kitExample: posterize
examples/shaders/ripple.kitExample: ripple
examples/shaders/scanlines.kitExample: scanlines
examples/shaders/sepia.kitExample: sepia
examples/shaders/sharpen.kitExample: sharpen
examples/shaders/simple-grayscale.kitExample: simple grayscale
examples/shaders/swirl.kitExample: swirl
examples/shaders/texture-outline.kitExample: texture outline
examples/shaders/vignette.kitExample: vignette
examples/shaders/wave.kitExample: wave
examples/shapes/basic-shapes.kitExample: basic shapes
examples/shapes/bouncing-ball.kitExample: bouncing ball
examples/shapes/collision-area.kitExample: collision area
examples/shapes/colors-palette.kitExample: colors palette
examples/shapes/dashed-line.kitExample: dashed line
examples/shapes/digital-clock.kitExample: digital clock
examples/shapes/draw-circle-sector.kitExample: draw circle sector
examples/shapes/draw-ellipse.kitExample: draw ellipse
examples/shapes/draw-polygon.kitExample: draw polygon
examples/shapes/draw-rectangle-rounded.kitExample: draw rectangle rounded
examples/shapes/draw-ring.kitExample: draw ring
examples/shapes/draw-triangle.kitExample: draw triangle
examples/shapes/easings-ball.kitExample: easings ball
examples/shapes/following-eyes.kitExample: following eyes
examples/shapes/lines-bezier.kitExample: lines bezier
examples/shapes/lines-drawing.kitExample: lines drawing
examples/shapes/logo-raylib-anim.kitExample: logo raylib anim
examples/shapes/logo-raylib.kitExample: logo raylib
examples/shapes/mouse-trail.kitExample: mouse trail
examples/shapes/pie-chart.kitExample: pie chart
examples/shapes/rectangle-scaling.kitExample: rectangle scaling
examples/shapes/recursive-tree.kitExample: recursive tree
examples/shapes/shapes.kitExample: shapes
examples/shapes/sine-cosine.kitExample: sine cosine
examples/shapes/starfield.kitExample: starfield
examples/shapes/vector-angle.kitExample: vector angle
examples/text/font-loading.kitExample: font loading
examples/text/format-text.kitExample: format text
examples/text/text-box-input.kitExample: text box input
examples/text/text-codepoints.kitExample: text codepoints
examples/text/text-colors.kitExample: text colors
examples/text/text-font-filters.kitExample: text font filters
examples/text/text-input.kitExample: text input
examples/text/text-measure.kitExample: text measure
examples/text/text-multiline.kitExample: text multiline
examples/text/text-rectangle-bounds.kitExample: text rectangle bounds
examples/text/text-scrolling.kitExample: text scrolling
examples/text/text-spacing.kitExample: text spacing
examples/text/text-styles.kitExample: text styles
examples/text/text-typewriter.kitExample: text typewriter
examples/text/writing-anim.kitExample: writing anim
examples/textures/background-scrolling.kitExample: background scrolling
examples/textures/color-palette.kitExample: color palette
examples/textures/gradient-images.kitExample: gradient images
examples/textures/image-alpha.kitExample: image alpha
examples/textures/image-channels.kitExample: image channels
examples/textures/image-compositing.kitExample: image compositing
examples/textures/image-cropping.kitExample: image cropping
examples/textures/image-drawing.kitExample: image drawing
examples/textures/image-generation.kitExample: image generation
examples/textures/image-mipmaps.kitExample: image mipmaps
examples/textures/image-processing.kitExample: image processing
examples/textures/image-resize.kitExample: image resize
examples/textures/image-rotation.kitExample: image rotation
examples/textures/noise-textures.kitExample: noise textures
examples/textures/npatch-drawing.kitExample: npatch drawing
examples/textures/particles-simple.kitExample: particles simple
examples/textures/power-of-two.kitExample: power of two
examples/textures/render-texture.kitExample: render texture
examples/textures/screenshot.kitExample: screenshot
examples/textures/sprite-animation.kitExample: sprite animation
examples/textures/texture-blending.kitExample: texture blending
examples/textures/texture-loading.kitExample: texture loading
examples/textures/texture-rotation.kitExample: texture rotation
examples/textures/texture-source-dest.kitExample: texture source dest
examples/textures/texture-tiling.kitExample: texture tiling
examples/textures/texture-to-image.kitExample: texture to image
fonts/FiraSans-Regular.ttfFiraSans-Regular.ttf
kit.tomlPackage manifest with metadata and dependencies
src/audio.kitInitialize audio device and context
src/camera.kitBegin 2D mode with custom camera.
src/collision.kitModule for collision
src/colors.kitModule for colors
src/core.kitCore module
src/files.kitCheck if file exists
src/input.kitModule for input
src/keys.kitNull key code
src/models.kitModule for models
src/raylib.kitMain module
src/rendering.kitBegin 2D mode with camera parameters
src/shaders.kitShaders - GPU Shader Management for Raylib
src/shapes.kitModule for shapes
src/text.kitModule for text
src/textures.kitModule for textures
src/types.kitColor type with RGBA components (0-255 for each channel)
src/utils.kitKit Raylib Utilities
tests/colors.test.kitTests for colors
tests/keys.test.kitTests for keys
tests/utils.test.kitTests for utils

Architecture

FFI Structure

graph TD A[Kit Code] -->|import Raylib| B[src/raylib.kit] B --> C[core.kit] B --> D[rendering.kit] B --> E[audio.kit] B --> F[input.kit] B --> G[textures.kit] B --> H[models.kit] B --> I[shaders.kit] C -->|extern-c| J[kit_raylib.c] D --> J E --> J F --> J G --> J H --> J I --> J J --> K[raylib C library]

Module Overview

graph LR subgraph Core A[Window] --> B[Timing] A --> C[Drawing] end subgraph Graphics D[Textures] --> E[Sprites] F[Shapes] --> G[2D Rendering] H[Models] --> I[3D Rendering] end subgraph Input J[Keyboard] K[Mouse] L[Gamepad] end subgraph Audio M[Sound] N[Music] end

Dependencies

No Kit package dependencies.

Native Requirements

This package requires the raylib library to be installed on your system:

PlatformCommand
macOSbrew install raylib
Ubuntusudo apt install libraylib-dev
Fedorasudo dnf install raylib-devel
WindowsDownload from https://www.raylib.com/

Installation

kit add gitlab.com/kit-lang/packages/kit-raylib.git

Usage

import Kit.Raylib as Raylib

main = fn =>
  Raylib.init-window 800 600 "My Game"
  defer Raylib.close-window

  Raylib.set-target-fps 60

  Raylib.run-game
    (fn => no-op)  # init
    (fn => no-op)  # update
    (fn =>         # draw
      Raylib.clear-background Raylib.black
      Raylib.draw-text "Hello, World!" 10 10 20 Raylib.white)

main

License

MIT License - see LICENSE for details.

Note: This package provides Kit bindings for raylib, which is licensed under the zlib/libpng license. When using kit-raylib, both licenses apply.

Bundled Font

This package includes Fira Sans font for use in examples. Fira Sans is licensed under the SIL Open Font License 1.1.

Exported Functions & Types

pack-color

Byte -> Byte -> Byte -> Byte -> Int

lightgray

Light gray color (RGB: 200, 200, 200)

Int

gray

Gray color (RGB: 130, 130, 130)

Int

darkgray

Dark gray color (RGB: 80, 80, 80)

Int

yellow

Yellow color (RGB: 253, 249, 0)

Int

gold

Gold color (RGB: 255, 203, 0)

Int

orange

Orange color (RGB: 255, 161, 0)

Int

pink

Pink color (RGB: 255, 109, 194)

Int

red

Red color (RGB: 230, 41, 55)

Int

maroon

Maroon color (RGB: 190, 33, 55)

Int

green

Green color (RGB: 0, 228, 48)

Int

lime

Lime color (RGB: 0, 158, 47)

Int

darkgreen

Dark green color (RGB: 0, 117, 44)

Int

skyblue

Sky blue color (RGB: 102, 191, 255)

Int

blue

Blue color (RGB: 0, 121, 241)

Int

darkblue

Dark blue color (RGB: 0, 82, 172)

Int

purple

Purple color (RGB: 200, 122, 255)

Int

violet

Violet color (RGB: 135, 60, 190)

Int

darkpurple

Dark purple color (RGB: 112, 31, 126)

Int

beige

Beige color (RGB: 211, 176, 131)

Int

brown

Brown color (RGB: 127, 106, 79)

Int

darkbrown

Dark brown color (RGB: 76, 63, 47)

Int

white

White color (RGB: 255, 255, 255)

Int

black

Black color (RGB: 0, 0, 0)

Int

blank

Transparent/blank color (RGBA: 0, 0, 0, 0)

Int

magenta

Magenta color (RGB: 255, 0, 255)

Int

raywhite

Raylib white color (RGB: 245, 245, 245)

Int

color

Create custom color from RGBA values (0-255)

Byte -> Byte -> Byte -> Byte -> Int

rgb

Create color from RGB values with full opacity (alpha = 255)

Byte -> Byte -> Byte -> Int

color-alpha

Extract alpha channel from a packed color (0-255)

Int -> Int

color-red

Extract red channel from a packed color (0-255)

Int -> Int

color-green

Extract green channel from a packed color (0-255)

Int -> Int

color-blue

Extract blue channel from a packed color (0-255)

Int -> Int

color-with-alpha

Create a new color with modified alpha (0-255)

Int -> Byte -> Int

color-lerp

Interpolate between two colors based on t (0.0 to 1.0) t=0.0 returns start-color, t=1.0 returns end-color

Int -> Int -> Float -> Int

fade

Apply alpha to a color (0.0 = fully transparent, 1.0 = fully opaque)

Int -> UnitFloat -> Int

color-alpha-blend

Apply alpha to color (0.0 to 1.0)

Int -> UnitFloat -> Int

blend-alpha

Alpha blend two colors with tint

Int -> Int -> Int -> Int

color-brightness

Adjust brightness of a color (-1.0 to 1.0)

Int -> Float -> Int

color-contrast

Adjust contrast of a color (-1.0 to 1.0)

Int -> Float -> Int

color-tint

Apply tint to a color

Int -> Int -> Int

color-from-hsv

Create color from HSV values (hue: 0-360, saturation: 0-1, value: 0-1)

Float -> UnitFloat -> UnitFloat -> Int

color-to-int

Convert color to integer

Int -> Int

color-lerp-raylib

Interpolate between two colors using Raylib (factor: 0.0 to 1.0)

Int -> Int -> UnitFloat -> Int

get-color

Get color from hex value (e.g., 0xFF0000FF for red)

Int -> Int

draw-pixel

Int -> Int -> Int -> Void

draw-line

Int -> Int -> Int -> Int -> Int -> Void

draw-line-ex

Float -> Float -> Float -> Float -> PositiveFloat -> Int -> Void

draw-line-bezier

Float -> Float -> Float -> Float -> PositiveFloat -> Int -> Void

draw-circle

Int -> Int -> PositiveFloat -> Int -> Void

draw-circle-v

Float -> Float -> PositiveFloat -> Int -> Void

draw-circle-lines

Int -> Int -> PositiveFloat -> Int -> Void

draw-circle-sector

Float -> Float -> PositiveFloat -> Float -> Float -> NonNegativeInt -> Int -> Void

draw-circle-sector-lines

Float -> Float -> PositiveFloat -> Float -> Float -> NonNegativeInt -> Int -> Void

draw-ellipse

Int -> Int -> PositiveFloat -> PositiveFloat -> Int -> Void

draw-ellipse-lines

Int -> Int -> PositiveFloat -> PositiveFloat -> Int -> Void

draw-ring

Float -> Float -> NonNegativeFloat -> PositiveFloat -> Float -> Float -> NonNegativeInt -> Int -> Void

draw-ring-lines

Float -> Float -> NonNegativeFloat -> PositiveFloat -> Float -> Float -> NonNegativeInt -> Int -> Void

draw-rectangle

Int -> Int -> PositiveInt -> PositiveInt -> Int -> Void

draw-rectangle-v

Float -> Float -> Float -> Float -> Int -> Void

draw-rectangle-lines

Int -> Int -> PositiveInt -> PositiveInt -> Int -> Void

draw-rectangle-lines-ex

Float -> Float -> Float -> Float -> PositiveFloat -> Int -> Void

draw-rectangle-pro

Float -> Float -> Float -> Float -> Float -> Float -> Float -> Int -> Void

draw-rectangle-rounded

Float -> Float -> Float -> Float -> UnitFloat -> NonNegativeInt -> Int -> Void

draw-rectangle-rounded-lines

Float -> Float -> Float -> Float -> UnitFloat -> NonNegativeInt -> Int -> Void

draw-rectangle-rounded-lines-ex

Float -> Float -> Float -> Float -> UnitFloat -> NonNegativeInt -> PositiveFloat -> Int -> Void

draw-triangle

Float -> Float -> Float -> Float -> Float -> Float -> Int -> Void

draw-triangle-lines

Float -> Float -> Float -> Float -> Float -> Float -> Int -> Void

draw-poly

Float -> Float -> PositiveInt -> PositiveFloat -> Float -> Int -> Void

draw-poly-lines

Float -> Float -> PositiveInt -> PositiveFloat -> Float -> Int -> Void

draw-poly-lines-ex

Float -> Float -> PositiveInt -> PositiveFloat -> Float -> PositiveFloat -> Int -> Void

draw-rectangle-gradient-h

Int -> Int -> PositiveInt -> PositiveInt -> Int -> Int -> Void

draw-rectangle-gradient-v

Int -> Int -> PositiveInt -> PositiveInt -> Int -> Int -> Void

draw-rectangle-gradient-ex

Int -> Int -> PositiveInt -> PositiveInt -> Int -> Int -> Int -> Int -> Void

draw-circle-gradient

Int -> Int -> PositiveFloat -> Int -> Int -> Void

draw-fps

Int -> Int -> Void

material-map-albedo

Albedo material map (diffuse color/texture)

Int

material-map-metalness

Metalness material map

Int

material-map-normal

Normal material map

Int

material-map-roughness

Roughness material map

Int

material-map-occlusion

Ambient occlusion material map

Int

material-map-emission

Emission material map

Int

material-map-height

Height material map (for parallax/displacement)

Int

material-map-cubemap

Cubemap material map

Int

material-map-irradiance

Irradiance material map (diffuse IBL)

Int

material-map-prefilter

Prefilter material map (specular IBL)

Int

material-map-brdf

BRDF LUT material map

Int

draw-line-3d

Float -> Float -> Float -> Float -> Float -> Float -> Int -> Void

draw-point-3d

Float -> Float -> Float -> Int -> Void

draw-circle-3d

Float -> Float -> Float -> PositiveFloat -> Float -> Float -> Float -> Float -> Int -> Void

draw-triangle-3d

Float -> Float -> Float -> Float -> Float -> Float -> Float -> Float -> Float -> Int -> Void

draw-cube

Float -> Float -> Float -> Float -> Float -> Float -> Int -> Void

draw-cube-wires

Float -> Float -> Float -> Float -> Float -> Float -> Int -> Void

draw-sphere

Float -> Float -> Float -> PositiveFloat -> Int -> Void

draw-sphere-ex

Float -> Float -> Float -> PositiveFloat -> PositiveInt -> PositiveInt -> Int -> Void

draw-sphere-wires

Float -> Float -> Float -> PositiveFloat -> PositiveInt -> PositiveInt -> Int -> Void

draw-cylinder

Float -> Float -> Float -> NonNegativeFloat -> NonNegativeFloat -> Float -> PositiveInt -> Int -> Void

draw-cylinder-wires

Float -> Float -> Float -> NonNegativeFloat -> NonNegativeFloat -> Float -> PositiveInt -> Int -> Void

draw-capsule

Float -> Float -> Float -> Float -> Float -> Float -> PositiveFloat -> PositiveInt -> PositiveInt -> Int -> Void

draw-capsule-wires

Float -> Float -> Float -> Float -> Float -> Float -> PositiveFloat -> PositiveInt -> PositiveInt -> Int -> Void

draw-plane

Float -> Float -> Float -> Float -> Float -> Int -> Void

draw-grid

PositiveInt -> Float -> Void

draw-bounding-box

Float -> Float -> Float -> Float -> Float -> Float -> Int -> Void

load-model

NonEmptyString -> Ptr

unload-model

Ptr -> Void

is-model-valid?

Ptr -> Bool

draw-model

Ptr -> Float -> Float -> Float -> Float -> Int -> Void

draw-model-ex

Ptr -> Float -> Float -> Float -> Float -> Float -> Float -> Float -> Float -> Float -> Float -> Int -> Void

draw-model-wires

Ptr -> Float -> Float -> Float -> Float -> Int -> Void

draw-model-wires-ex

Ptr -> Float -> Float -> Float -> Float -> Float -> Float -> Float -> Float -> Float -> Float -> Int -> Void

draw-model-points

Ptr -> Float -> Float -> Float -> Float -> Int -> Void

draw-model-points-ex

Ptr -> Float -> Float -> Float -> Float -> Float -> Float -> Float -> Float -> Float -> Float -> Int -> Void

get-model-mesh-count

Ptr -> Int

get-model-material-count

Ptr -> Int

get-model-bone-count

Ptr -> Int

gen-mesh-poly

PositiveInt -> PositiveFloat -> Ptr

gen-mesh-plane

Float -> Float -> Int -> Int -> Ptr

gen-mesh-cube

Float -> Float -> Float -> Ptr

gen-mesh-sphere

PositiveFloat -> PositiveInt -> PositiveInt -> Ptr

gen-mesh-hemisphere

PositiveFloat -> PositiveInt -> PositiveInt -> Ptr

gen-mesh-cylinder

PositiveFloat -> Float -> PositiveInt -> Ptr

gen-mesh-cone

PositiveFloat -> Float -> PositiveInt -> Ptr

gen-mesh-torus

PositiveFloat -> Float -> PositiveInt -> PositiveInt -> Ptr

gen-mesh-knot

PositiveFloat -> Float -> PositiveInt -> PositiveInt -> Ptr

gen-mesh-heightmap

Ptr -> Float -> Float -> Float -> Ptr

gen-mesh-cubicmap

Ptr -> Float -> Ptr

unload-mesh

Ptr -> Void

export-mesh?

Ptr -> NonEmptyString -> Bool

load-model-from-mesh

Ptr -> Ptr

upload-mesh

Ptr -> Bool -> Void

gen-mesh-tangents

Ptr -> Void

update-model-animation

Ptr -> Ptr -> Int -> Int -> Void

update-model-animation-bones

Ptr -> Ptr -> Int -> Int -> Void

unload-model-animation

Ptr -> Int -> Void

unload-model-animations

Ptr -> Void

is-model-animation-valid?

Ptr -> Ptr -> Int -> Bool

get-model-animation-frame-count

Ptr -> Int -> Int

get-model-animation-bone-count

Ptr -> Int -> Int

load-material-default

Ptr

is-material-valid?

Ptr -> Bool

unload-material

Ptr -> Void

set-material-texture

Ptr -> Int -> Ptr -> Void

set-model-mesh-material

Ptr -> Int -> Int -> Void

draw-billboard

Ptr -> Ptr -> Float -> Float -> Float -> Float -> Int -> Void

draw-billboard-rec

Ptr -> Ptr -> Float -> Float -> Float -> Float -> Float -> Float -> Float -> Float -> Float -> Int -> Void

draw-billboard-pro

Ptr -> Ptr -> Float -> Float -> Float -> Float -> Float -> Float -> Float -> Float -> Float -> Float -> Float -> Float -> Float -> Float -> Float -> Int -> Void

check-collision-spheres?

Float -> Float -> Float -> PositiveFloat -> Float -> Float -> Float -> PositiveFloat -> Bool

check-collision-box-sphere?

Float -> Float -> Float -> Float -> Float -> Float -> Float -> Float -> Float -> PositiveFloat -> Bool

check-collision-boxes?

Float -> Float -> Float -> Float -> Float -> Float -> Float -> Float -> Float -> Float -> Float -> Float -> Bool

create-ray

Float -> Float -> Float -> Float -> Float -> Float -> Ptr

unload-ray

Ptr -> Void

get-screen-to-world-ray

Int -> Int -> Ptr -> Ptr

get-screen-to-world-ray-ex

Int -> Int -> Ptr -> Int -> Int -> Ptr

get-ray-collision-sphere

Ptr -> Float -> Float -> Float -> PositiveFloat -> Ptr

get-ray-collision-box

Ptr -> Float -> Float -> Float -> Float -> Float -> Float -> Ptr

get-ray-collision-mesh

Ptr -> Ptr -> Float -> Float -> Float -> Float -> Float -> Float -> Float -> Float -> Float -> Float -> Float -> Float -> Float -> Float -> Float -> Float -> Ptr

get-ray-collision-triangle

Ptr -> Float -> Float -> Float -> Float -> Float -> Float -> Float -> Float -> Float -> Ptr

get-ray-collision-quad

Ptr -> Float -> Float -> Float -> Float -> Float -> Float -> Float -> Float -> Float -> Float -> Float -> Float -> Ptr

unload-ray-collision

Ptr -> Void

ray-collision-hit?

Ptr -> Bool

ray-collision-distance

Ptr -> Float

ray-collision-point-x

Ptr -> Float

ray-collision-point-y

Ptr -> Float

ray-collision-point-z

Ptr -> Float

ray-collision-normal-x

Ptr -> Float

ray-collision-normal-y

Ptr -> Float

ray-collision-normal-z

Ptr -> Float

begin-mode-2d

Float -> Float -> Float -> Float -> Float -> Float -> Void

end-mode-2d

Void

begin-mode-3d

Float -> Float -> Float -> Float -> Float -> Float -> Float -> Float -> Float -> Float -> Int -> Void

end-mode-3d

Void

camera-perspective

Perspective projection (realistic depth perception)

camera-orthographic

Orthographic projection (no depth perspective, good for 2D-style 3D)

begin-blend-mode

Int -> Void

end-blend-mode

Void

blend-alpha

Blend textures considering alpha (default mode)

blend-additive

Blend textures adding colors (brightening effect)

blend-multiplied

Blend textures multiplying colors (darkening effect)

blend-add-colors

Blend textures adding colors (alternative implementation)

blend-subtract-colors

Blend textures subtracting colors

blend-alpha-premultiply

Blend premultiplied textures considering alpha

blend-custom

Blend textures using custom src/dst factors

begin-scissor-mode

Int -> Int -> Int -> Int -> Void

end-scissor-mode

Void

begin-shader-mode

{ptr: Ptr} -> Void

end-shader-mode

Void

Ray definition (origin point and direction vector)

Ray collision result data

check-collision-recs?

Check collision between two rectangles Returns true if the rectangles overlap

Float -> Float -> Float -> Float -> Float -> Float -> Float -> Float -> Bool

check-collision-circles?

Check collision between two circles Returns true if the circles overlap

Float -> Float -> Float -> Float -> Float -> Float -> Bool

check-collision-circle-rec?

Check collision between circle and rectangle Returns true if the circle and rectangle overlap

Float -> Float -> Float -> Float -> Float -> Float -> Float -> Bool

check-collision-point-rec?

Check if point is inside rectangle Returns true if the point is within the rectangle bounds

Float -> Float -> Float -> Float -> Float -> Float -> Bool

check-collision-point-circle?

Check if point is inside circle Returns true if the point is within the circle

Float -> Float -> Float -> Float -> Float -> Bool

check-collision-point-triangle?

Check if point is inside a triangle Returns true if the point is within the triangle defined by three vertices

Float -> Float -> Float -> Float -> Float -> Float -> Float -> Float -> Bool

check-collision-point-line?

Check if point is near a line (within threshold) Returns true if the point is within the specified threshold distance from the line

Float -> Float -> Float -> Float -> Float -> Float -> Int -> Bool

check-collision-circle-line?

Check collision between circle and line Returns true if the circle intersects with the line segment

Float -> Float -> Float -> Float -> Float -> Float -> Float -> Bool

check-collision-lines?

Check collision between two lines Returns true if the two line segments intersect

Float -> Float -> Float -> Float -> Float -> Float -> Float -> Float -> Bool

check-collision-spheres?

Check collision between two spheres Returns true if the spheres overlap

Float -> Float -> Float -> Float -> Float -> Float -> Float -> Float -> Bool

check-collision-box-sphere?

Check collision between bounding box and sphere Returns true if the box and sphere overlap

Float -> Float -> Float -> Float -> Float -> Float -> Float -> Float -> Float -> Float -> Bool

check-collision-boxes?

Check collision between two bounding boxes Returns true if the boxes overlap

Float -> Float -> Float -> Float -> Float -> Float -> Float -> Float -> Float -> Float -> Float -> Float -> Bool

create-ray

Create a ray from origin point and direction vector

Float -> Float -> Float -> Float -> Float -> Float -> {ptr: Ptr}

unload-ray

Unload ray from memory

{ptr: Ptr} -> Void

get-screen-to-world-ray

Get a ray trace from mouse position to 3D world Requires a 3D camera (record with ptr field)

Int -> Int -> {ptr: Ptr} -> Option {ptr: Ptr}

get-screen-to-world-ray-ex

Get a ray trace from mouse position to 3D world with custom viewport size Requires a 3D camera (record with ptr field)

Int -> Int -> {ptr: Ptr} -> Int -> Int -> Option {ptr: Ptr}

get-ray-collision-sphere

Get collision info between ray and sphere Returns None if no collision, Some(RayCollision) otherwise

{ptr: Ptr} -> Float -> Float -> Float -> Float -> Option {ptr: Ptr}

get-ray-collision-box

Get collision info between ray and bounding box Returns None if no collision, Some(RayCollision) otherwise

{ptr: Ptr} -> Float -> Float -> Float -> Float -> Float -> Float -> Option {ptr: Ptr}

get-ray-collision-mesh

Get collision info between ray and mesh with transform matrix Matrix is provided as 16 individual float values (column-major order) Returns None if no collision, Some(RayCollision) otherwise

{ptr: Ptr} -> Ptr -> Float -> Float -> Float -> Float -> Float -> Float -> Float -> Float -> Float -> Float -> Float -> Float -> Float -> Float -> Float -> Float -> Option {ptr: Ptr}

get-ray-collision-triangle

Get collision info between ray and triangle Triangle is defined by three 3D vertices Returns None if no collision, Some(RayCollision) otherwise

{ptr: Ptr} -> Float -> Float -> Float -> Float -> Float -> Float -> Float -> Float -> Float -> Option {ptr: Ptr}

get-ray-collision-quad

Get collision info between ray and quad Quad is defined by four 3D vertices Returns None if no collision, Some(RayCollision) otherwise

{ptr: Ptr} -> Float -> Float -> Float -> Float -> Float -> Float -> Float -> Float -> Float -> Float -> Float -> Float -> Option {ptr: Ptr}

unload-ray-collision

Unload ray collision result from memory

{ptr: Ptr} -> Void

ray-collision-hit?

Check if ray collision hit occurred Returns true if the ray hit the target

{ptr: Ptr} -> Bool

ray-collision-distance

Get ray collision distance from ray origin to hit point

{ptr: Ptr} -> Float

ray-collision-point

Get ray collision point coordinates as a record Returns {x: Float, y: Float, z: Float}

{ptr: Ptr} -> {x: Float, y: Float, z: Float}

ray-collision-normal

Get ray collision normal vector as a record Returns {x: Float, y: Float, z: Float}

{ptr: Ptr} -> {x: Float, y: Float, z: Float}

draw-bounding-box

Draw a bounding box with wireframe lines Box is defined by minimum and maximum corner points

Float -> Float -> Float -> Float -> Float -> Float -> Int -> Void

key-null

Null key code

Int

key-apostrophe

Apostrophe key (')

Int

key-comma

Comma key (,)

Int

key-minus

Minus key (-)

Int

key-period

Period key (.)

Int

key-slash

Slash key (/)

Int

key-zero

Number 0 key

Int

key-one

Number 1 key

Int

key-two

Number 2 key

Int

key-three

Number 3 key

Int

key-four

Number 4 key

Int

key-five

Number 5 key

Int

key-six

Number 6 key

Int

key-seven

Number 7 key

Int

key-eight

Number 8 key

Int

key-nine

Number 9 key

Int

key-semicolon

Semicolon key (;)

Int

key-equal

Equal key (=)

Int

key-a

A key

Int

key-b

B key

Int

key-c

C key

Int

key-d

D key

Int

key-e

E key

Int

key-f

F key

Int

key-g

G key

Int

key-h

H key

Int

key-i

I key

Int

key-j

J key

Int

key-k

K key

Int

key-l

L key

Int

key-m

M key

Int

key-n

N key

Int

key-o

O key

Int

key-p

P key

Int

key-q

Q key

Int

key-r

R key

Int

key-s

S key

Int

key-t

T key

Int

key-u

U key

Int

key-v

V key

Int

key-w

W key

Int

key-x

X key

Int

key-y

Y key

Int

key-z

Z key

Int

key-space

Space key

Int

key-escape

Escape key

Int

key-enter

Enter/Return key

Int

key-tab

Tab key

Int

key-backspace

Backspace key

Int

key-insert

Insert key

Int

key-delete

Delete key

Int

key-right

Right arrow key

Int

key-left

Left arrow key

Int

key-down

Down arrow key

Int

key-up

Up arrow key

Int

key-page-up

Page Up key

Int

key-page-down

Page Down key

Int

key-home

Home key

Int

key-end

End key

Int

key-caps-lock

Caps Lock key

Int

key-scroll-lock

Scroll Lock key

Int

key-num-lock

Num Lock key

Int

key-print-screen

Print Screen key

Int

key-pause

Pause key

Int

key-f1

F1 function key

Int

key-f2

F2 function key

Int

key-f3

F3 function key

Int

key-f4

F4 function key

Int

key-f5

F5 function key

Int

key-f6

F6 function key

Int

key-f7

F7 function key

Int

key-f8

F8 function key

Int

key-f9

F9 function key

Int

key-f10

F10 function key

Int

key-f11

F11 function key

Int

key-f12

F12 function key

Int

key-left-shift

Left Shift key

Int

key-left-control

Left Control key

Int

key-left-alt

Left Alt key

Int

key-left-super

Left Super/Command/Windows key

Int

key-right-shift

Right Shift key

Int

key-right-control

Right Control key

Int

key-right-alt

Right Alt key

Int

key-right-super

Right Super/Command/Windows key

Int

mouse-left

Left mouse button

Int

mouse-right

Right mouse button

Int

mouse-middle

Middle mouse button (scroll wheel click)

Int

log-all

Display all logs

Int

log-trace

Trace logging, intended for internal use only

Int

log-debug

Debug logging, used for internal debugging

Int

log-info

Info logging, used for program execution info

Int

log-warning

Warning logging, used on recoverable failures

Int

log-error

Error logging, used on unrecoverable failures

Int

log-fatal

Fatal logging, used to abort program

Int

log-none

Disable logging

Int

flag-vsync-hint

Set to try enabling V-Sync on GPU

Int

flag-fullscreen-mode

Set to run program in fullscreen

Int

flag-window-resizable

Set to allow resizable window

Int

flag-window-undecorated

Set to disable window decoration (frame and buttons)

Int

flag-window-hidden

Set to hide window

Int

flag-window-minimized

Set to minimize window (iconify)

Int

flag-window-maximized

Set to maximize window (expanded to monitor)

Int

flag-window-unfocused

Set to window non-focused

Int

flag-window-topmost

Set to window always on top

Int

flag-window-always-run

Set to allow windows running while minimized

Int

flag-window-transparent

Set to allow transparent framebuffer

Int

flag-window-highdpi

Set to support HighDPI

Int

flag-msaa-4x-hint

Set to try enabling MSAA 4X

Int

gamepad-button-unknown

Unknown gamepad button

Int

gamepad-button-left-face-up

Gamepad left D-pad up button

Int

gamepad-button-left-face-right

Gamepad left D-pad right button

Int

gamepad-button-left-face-down

Gamepad left D-pad down button

Int

gamepad-button-left-face-left

Gamepad left D-pad left button

Int

gamepad-button-right-face-up

Gamepad right button up (Y on Xbox, Triangle on PS)

Int

gamepad-button-right-face-right

Gamepad right button right (B on Xbox, Circle on PS)

Int

gamepad-button-right-face-down

Gamepad right button down (A on Xbox, Cross on PS)

Int

gamepad-button-right-face-left

Gamepad right button left (X on Xbox, Square on PS)

Int

gamepad-button-left-trigger-1

Gamepad left trigger 1 (LB on Xbox)

Int

gamepad-button-left-trigger-2

Gamepad left trigger 2 (LT on Xbox)

Int

gamepad-button-right-trigger-1

Gamepad right trigger 1 (RB on Xbox)

Int

gamepad-button-right-trigger-2

Gamepad right trigger 2 (RT on Xbox)

Int

gamepad-button-middle-left

Gamepad middle left button (Select on Xbox)

Int

gamepad-button-middle

Gamepad center button (Guide on Xbox)

Int

gamepad-button-middle-right

Gamepad middle right button (Start on Xbox)

Int

gamepad-button-left-thumb

Gamepad left stick pressed button

Int

gamepad-button-right-thumb

Gamepad right stick pressed button

Int

gamepad-axis-left-x

Gamepad left stick X axis

Int

gamepad-axis-left-y

Gamepad left stick Y axis

Int

gamepad-axis-right-x

Gamepad right stick X axis

Int

gamepad-axis-right-y

Gamepad right stick Y axis

Int

gamepad-axis-left-trigger

Gamepad left trigger axis (pressure level)

Int

gamepad-axis-right-trigger

Gamepad right trigger axis (pressure level)

Int

gesture-none

No gesture detected

Int

gesture-tap

Tap gesture

Int

gesture-doubletap

Double tap gesture

Int

gesture-hold

Hold gesture

Int

gesture-drag

Drag gesture

Int

gesture-swipe-right

Swipe right gesture

Int

gesture-swipe-left

Swipe left gesture

Int

gesture-swipe-up

Swipe up gesture

Int

gesture-swipe-down

Swipe down gesture

Int

gesture-pinch-in

Pinch in gesture

Int

gesture-pinch-out

Pinch out gesture

Int

file-exists?

Check if file exists at the given path.

String -> Bool

if Files.file-exists? "saves/game.dat" then
  print "Save file found"

directory-exists?

Check if a directory exists at the given path.

String -> Bool

if Files.directory-exists? "assets/images" then
  print "Assets directory found"

is-file-extension?

Check if a file has the specified extension. Extension should include the dot (e.g., ".png", ".wav").

String -> String -> Bool

if Files.is-file-extension? "image.png" ".png" then
  print "PNG image found"

get-file-length

Get file length in bytes.

String -> Int

size = Files.get-file-length "data.bin"
print "File size: ${size} bytes"

get-file-extension

Get the file extension for a filename (includes the dot, e.g., ".png").

String -> String

ext = Files.get-file-extension "image.png"
# ext == ".png"

get-file-name

Get the filename from a full path string.

String -> String

name = Files.get-file-name "/path/to/image.png"
# name == "image.png"

get-file-name-without-ext

Get the filename without its extension.

String -> String

name = Files.get-file-name-without-ext "/path/to/image.png"
# name == "image"

get-directory-path

Get the directory path from a full file path.

String -> String

dir = Files.get-directory-path "/path/to/image.png"
# dir == "/path/to"

get-prev-directory-path

Get the parent directory path for a given path.

String -> String

parent = Files.get-prev-directory-path "/path/to/dir"
# parent == "/path/to"

get-working-directory

Get the current working directory.

String

cwd = Files.get-working-directory()
print "Working dir: ${cwd}"

get-application-directory

Get the directory of the running application.

String

app-dir = Files.get-application-directory()
print "App dir: ${app-dir}"

make-directory?

Create a new directory at the given path. Returns true on success.

String -> Bool

if Files.make-directory? "saves" then
  print "Directory created"

change-directory?

Change the current working directory. Returns true on success.

String -> Bool

if Files.change-directory? "/new/path" then
  print "Changed directory"

is-path-file?

Check if the given path points to a file (not a directory).

String -> Bool

if Files.is-path-file? "data.txt" then
  print "It's a file"

is-file-name-valid?

Check if a filename is valid for the current platform/OS.

String -> Bool

if Files.is-file-name-valid? "my:file.txt" then
  print "Valid filename"
else
  print "Invalid filename"

get-file-mod-time

Get file modification time (Unix timestamp).

String -> Int

mod-time = Files.get-file-mod-time "config.toml"

load-file-text

Load text content from a file.

String -> String

content = Files.load-file-text "story.txt"
print content

save-file-text?

Save text content to a file. Returns true on success.

String -> String -> Bool

if Files.save-file-text? "output.txt" "Hello, World!" then
  print "File saved"

set-random-seed

Set the seed for the random number generator. Use this for reproducible random sequences.

Int -> Void

Files.set-random-seed 12345
# Random values will now be deterministic

get-random-value

Get a random integer value between min and max (both inclusive).

Int -> Int -> Int

dice = Files.get-random-value 1 6
enemy-count = Files.get-random-value 3 10

load-random-sequence

Load a random sequence of unique values in the given range. The sequence contains 'count' unique values between min and max. No values are repeated in the sequence.

Int -> Int -> Int -> Ptr

# Generate 5 unique numbers between 1 and 10
seq = Files.load-random-sequence 5 1 10
# Use values...
Files.unload-random-sequence seq

unload-random-sequence

Unload a random sequence and free its memory.

Ptr -> Void

seq = Files.load-random-sequence 5 1 10
# Use sequence...
Files.unload-random-sequence seq

get-random-sequence-value

Get a value from a random sequence at the specified index.

Ptr -> Int -> Int

seq = Files.load-random-sequence 5 1 10
first = Files.get-random-sequence-value seq 0
second = Files.get-random-sequence-value seq 1
Files.unload-random-sequence seq

push-matrix

Push the current matrix onto the stack. Used to save the current transformation state.

Void

Files.push-matrix()
Files.translate 100.0 0.0 0.0
# Draw transformed objects...
Files.pop-matrix()  # Restore previous state

pop-matrix

Pop the latest matrix from the stack. Restores the previous transformation state.

Void

Files.push-matrix()
Files.rotate 45.0 0.0 0.0 1.0
# Draw rotated objects...
Files.pop-matrix()  # Back to original state

load-identity

Reset the current matrix to the identity matrix. Clears all transformations.

Void

Files.load-identity()
# Matrix is now reset to no transformation

translate

Apply a translation transformation to the current matrix.

Float -> Float -> Float -> Void

Files.push-matrix()
Files.translate 100.0 200.0 0.0  # Move right 100, down 200
# Draw at new position...
Files.pop-matrix()

rotate

Apply a rotation transformation to the current matrix. Angle is in degrees. The axis is specified by (x, y, z).

Float -> Float -> Float -> Float -> Void

Files.push-matrix()
Files.rotate 45.0 0.0 0.0 1.0  # Rotate 45 degrees around Z-axis
# Draw rotated objects...
Files.pop-matrix()

scale

Apply a scaling transformation to the current matrix.

Float -> Float -> Float -> Void

Files.push-matrix()
Files.scale 2.0 2.0 1.0  # Scale 2x in X and Y
# Draw scaled objects...
Files.pop-matrix()

init-audio

Initialize audio device and context Should be paired with close-audio

Void

close-audio

Close the audio device and context

Void

is-audio-ready?

Check if audio device has been initialized successfully

Bool

set-master-volume

Set master volume (listener) volume: 0.0 (mute) to 1.0 (full volume)

UnitFloat -> Void

get-master-volume

Get master volume (0.0 to 1.0)

Float

load-sound

Load sound from file

NonEmptyString -> Ptr

unload-sound

Unload sound from memory

Ptr -> Void

play-sound

Play a sound

Ptr -> Void

stop-sound

Stop playing a sound

Ptr -> Void

pause-sound

Pause a sound

Ptr -> Void

resume-sound

Resume a paused sound

Ptr -> Void

is-sound-playing?

Check if a sound is currently playing

Ptr -> Bool

set-sound-volume

Set volume for a sound (0.0 to 1.0)

Ptr -> UnitFloat -> Void

set-sound-pitch

Set pitch for a sound (1.0 is base pitch)

Ptr -> Float -> Void

set-sound-pan

Set pan for a sound (-1.0 left, 0.0 center, 1.0 right)

Ptr -> Float -> Void

load-sound-from-wave

Load sound from wave data

Ptr -> Ptr

load-music

Load music stream from file

NonEmptyString -> Ptr

unload-music

Unload music stream

Ptr -> Void

play-music

Start music playing

Ptr -> Void

stop-music

Stop music playing

Ptr -> Void

update-music

Updates buffers for music streaming Call this in your game loop to keep music playing

Ptr -> Void

pause-music

Pause music playing

Ptr -> Void

resume-music

Resume playing paused music

Ptr -> Void

is-music-playing?

Check if music is playing

Ptr -> Bool

seek-music

Seek music to a position (in seconds)

Ptr -> Float -> Void

seek-music-stream

Seek music stream to a position (in seconds) Alternate name for seek-music

Ptr -> Float -> Void

set-music-volume

Set volume for music (0.0 to 1.0)

Ptr -> UnitFloat -> Void

set-music-pitch

Set pitch for a music stream (1.0 is base pitch)

Ptr -> Float -> Void

set-music-pan

Set pan for a music stream (-1.0 left, 0.0 center, 1.0 right)

Ptr -> Float -> Void

get-music-time-length

Get music time length (in seconds)

Ptr -> Float

get-music-time-played

Get current music time played (in seconds)

Ptr -> Float

load-wave

Load wave data from file

NonEmptyString -> Ptr

is-wave-valid?

Check if wave data is valid

Ptr -> Bool

unload-wave

Unload wave data

Ptr -> Void

export-wave?

Export wave data to file Returns true on success

Ptr -> NonEmptyString -> Bool

wave-copy

Copy a wave to a new wave

Ptr -> Ptr

wave-crop

Crop a wave to defined frames range

Ptr -> Int -> Int -> Void

wave-format

Convert wave data to desired format sample-rate: Samples per second (e.g., 44100) sample-size: Bits per sample (e.g., 16) channels: Number of channels (1 = mono, 2 = stereo)

Ptr -> Int -> Int -> Int -> Void

load-audio-stream

Load audio stream (to stream raw audio data) sample-rate: Samples per second (e.g., 44100) sample-size: Bits per sample (e.g., 16) channels: Number of channels (1 = mono, 2 = stereo)

Int -> Int -> Int -> Ptr

is-audio-stream-valid?

Check if audio stream is valid

Ptr -> Bool

unload-audio-stream

Unload audio stream

Ptr -> Void

play-audio-stream

Play audio stream

Ptr -> Void

pause-audio-stream

Pause audio stream

Ptr -> Void

resume-audio-stream

Resume audio stream

Ptr -> Void

stop-audio-stream

Stop audio stream

Ptr -> Void

is-audio-stream-playing?

Check if audio stream is playing

Ptr -> Bool

is-audio-stream-processed?

Check if audio stream buffer has been processed (consumed)

Ptr -> Bool

set-audio-stream-volume

Set volume for audio stream (0.0 to 1.0)

Ptr -> UnitFloat -> Void

set-audio-stream-pitch

Set pitch for audio stream (1.0 is base pitch)

Ptr -> Float -> Void

set-audio-stream-pan

Set pan for audio stream (-1.0 left, 0.0 center, 1.0 right)

Ptr -> Float -> Void

load-shader

Load shader from vertex and fragment shader files Pass empty string for either to use the default shader

String -> String -> {ptr: Ptr}

load-shader-from-memory

Load shader from vertex and fragment shader code strings Pass empty string for either to use the default shader

String -> String -> {ptr: Ptr}

unload

Unload shader from GPU memory (VRAM)

{ptr: Ptr} -> Void

is-valid?

Check if a shader is valid (program exists in GPU)

{ptr: Ptr} -> Bool

get-location

Get shader uniform location by name Returns -1 if uniform not found

{ptr: Ptr} -> NonEmptyString -> Int

get-location-attrib

Get shader attribute location by name Returns -1 if attribute not found

{ptr: Ptr} -> NonEmptyString -> Int

set-value-float

Set shader uniform value (float)

{ptr: Ptr} -> Int -> Float -> Void

set-value-int

Set shader uniform value (int)

{ptr: Ptr} -> Int -> Int -> Void

set-value-vec2

Set shader uniform value (vec2)

{ptr: Ptr} -> Int -> Float -> Float -> Void

set-value-vec3

Set shader uniform value (vec3)

{ptr: Ptr} -> Int -> Float -> Float -> Float -> Void

set-value-vec4

Set shader uniform value (vec4)

{ptr: Ptr} -> Int -> Float -> Float -> Float -> Float -> Void

set-value-matrix

Set shader uniform value (4x4 matrix) Matrix values are in column-major order (OpenGL convention)

{ptr: Ptr} -> Int -> Float -> Float -> Float -> Float -> Float -> Float -> Float -> Float -> Float -> Float -> Float -> Float -> Float -> Float -> Float -> Float -> Void

set-value-texture

Set shader uniform value for texture sampler

{ptr: Ptr} -> Int -> Ptr -> Void

begin-mode

Begin custom shader drawing mode All subsequent draw calls will use this shader until end-mode is called

{ptr: Ptr} -> Void

end-mode

End custom shader drawing mode (returns to default shader)

Void

create-vr-device-info

Create VR device info with display parameters h-res, v-res: display resolution in pixels h-screen, v-screen: physical screen size in meters eye-dist: eye to screen distance in meters lens-sep: lens separation distance in meters ipd: interpupillary distance in meters

Int -> Int -> Float -> Float -> Float -> Float -> Float -> {ptr: Ptr}

set-vr-device-lens-distortion

Set VR device lens distortion coefficients d0, d1, d2, d3: distortion coefficients (k0, k1, k2, k3)

{ptr: Ptr} -> Float -> Float -> Float -> Float -> Void

set-vr-device-chroma-correction

Set VR device chromatic aberration correction coefficients c0, c1, c2, c3: chromatic correction coefficients (r, g, b, unused)

{ptr: Ptr} -> Float -> Float -> Float -> Float -> Void

unload-vr-device-info

Unload VR device info from memory

{ptr: Ptr} -> Void

load-vr-stereo-config

Load VR stereo configuration for specified device

{ptr: Ptr} -> {ptr: Ptr}

unload-vr-stereo-config

Unload VR stereo configuration from memory

{ptr: Ptr} -> Void

begin-vr-stereo-mode

Begin VR stereo rendering mode All subsequent draw calls will be rendered for both eyes until end-vr-stereo-mode is called

{ptr: Ptr} -> Void

end-vr-stereo-mode

End VR stereo rendering mode

Void

key-null

Null key code

Int

key-apostrophe

Apostrophe key (')

Int

key-comma

Comma key (,)

Int

key-minus

Minus key (-)

Int

key-period

Period key (.)

Int

key-slash

Slash key (/)

Int

key-zero

Number 0 key

Int

key-one

Number 1 key

Int

key-two

Number 2 key

Int

key-three

Number 3 key

Int

key-four

Number 4 key

Int

key-five

Number 5 key

Int

key-six

Number 6 key

Int

key-seven

Number 7 key

Int

key-eight

Number 8 key

Int

key-nine

Number 9 key

Int

key-semicolon

Semicolon key (;)

Int

key-equal

Equal key (=)

Int

key-a

A key

Int

key-b

B key

Int

key-c

C key

Int

key-d

D key

Int

key-e

E key

Int

key-f

F key

Int

key-g

G key

Int

key-h

H key

Int

key-i

I key

Int

key-j

J key

Int

key-k

K key

Int

key-l

L key

Int

key-m

M key

Int

key-n

N key

Int

key-o

O key

Int

key-p

P key

Int

key-q

Q key

Int

key-r

R key

Int

key-s

S key

Int

key-t

T key

Int

key-u

U key

Int

key-v

V key

Int

key-w

W key

Int

key-x

X key

Int

key-y

Y key

Int

key-z

Z key

Int

key-space

Space key

Int

key-escape

Escape key

Int

key-enter

Enter/Return key

Int

key-tab

Tab key

Int

key-backspace

Backspace key

Int

key-insert

Insert key

Int

key-delete

Delete key

Int

key-right

Right arrow key

Int

key-left

Left arrow key

Int

key-down

Down arrow key

Int

key-up

Up arrow key

Int

key-page-up

Page Up key

Int

key-page-down

Page Down key

Int

key-home

Home key

Int

key-end

End key

Int

key-caps-lock

Caps Lock key

Int

key-scroll-lock

Scroll Lock key

Int

key-num-lock

Num Lock key

Int

key-print-screen

Print Screen key

Int

key-pause

Pause key

Int

key-f1

F1 function key

Int

key-f2

F2 function key

Int

key-f3

F3 function key

Int

key-f4

F4 function key

Int

key-f5

F5 function key

Int

key-f6

F6 function key

Int

key-f7

F7 function key

Int

key-f8

F8 function key

Int

key-f9

F9 function key

Int

key-f10

F10 function key

Int

key-f11

F11 function key

Int

key-f12

F12 function key

Int

key-left-shift

Left Shift key

Int

key-left-control

Left Control key

Int

key-left-alt

Left Alt key

Int

key-left-super

Left Super/Command/Windows key

Int

key-right-shift

Right Shift key

Int

key-right-control

Right Control key

Int

key-right-alt

Right Alt key

Int

key-right-super

Right Super/Command/Windows key

Int

mouse-left

Left mouse button

Int

mouse-right

Right mouse button

Int

mouse-middle

Middle mouse button (scroll wheel click)

Int

cursor-default

Default cursor

Int

cursor-arrow

Arrow cursor

Int

cursor-ibeam

Text input cursor (I-beam)

Int

cursor-crosshair

Crosshair cursor

Int

cursor-pointing-hand

Pointing hand cursor (for links)

Int

cursor-resize-ew

Horizontal resize cursor (east-west)

Int

cursor-resize-ns

Vertical resize cursor (north-south)

Int

cursor-resize-nwse

Diagonal resize cursor (northwest-southeast)

Int

cursor-resize-nesw

Diagonal resize cursor (northeast-southwest)

Int

cursor-resize-all

Move/resize all directions cursor

Int

cursor-not-allowed

Not allowed cursor

Int

gamepad-button-unknown

Unknown gamepad button

Int

gamepad-button-left-face-up

Gamepad left D-pad up button

Int

gamepad-button-left-face-right

Gamepad left D-pad right button

Int

gamepad-button-left-face-down

Gamepad left D-pad down button

Int

gamepad-button-left-face-left

Gamepad left D-pad left button

Int

gamepad-button-right-face-up

Gamepad right button up (Y on Xbox, Triangle on PS)

Int

gamepad-button-right-face-right

Gamepad right button right (B on Xbox, Circle on PS)

Int

gamepad-button-right-face-down

Gamepad right button down (A on Xbox, Cross on PS)

Int

gamepad-button-right-face-left

Gamepad right button left (X on Xbox, Square on PS)

Int

gamepad-button-left-trigger-1

Gamepad left trigger 1 (LB on Xbox)

Int

gamepad-button-left-trigger-2

Gamepad left trigger 2 (LT on Xbox)

Int

gamepad-button-right-trigger-1

Gamepad right trigger 1 (RB on Xbox)

Int

gamepad-button-right-trigger-2

Gamepad right trigger 2 (RT on Xbox)

Int

gamepad-button-middle-left

Gamepad middle left button (Select on Xbox)

Int

gamepad-button-middle

Gamepad center button (Guide on Xbox)

Int

gamepad-button-middle-right

Gamepad middle right button (Start on Xbox)

Int

gamepad-button-left-thumb

Gamepad left stick pressed button

Int

gamepad-button-right-thumb

Gamepad right stick pressed button

Int

gamepad-axis-left-x

Gamepad left stick X axis

Int

gamepad-axis-left-y

Gamepad left stick Y axis

Int

gamepad-axis-right-x

Gamepad right stick X axis

Int

gamepad-axis-right-y

Gamepad right stick Y axis

Int

gamepad-axis-left-trigger

Gamepad left trigger axis (pressure level)

Int

gamepad-axis-right-trigger

Gamepad right trigger axis (pressure level)

Int

gesture-none

No gesture detected

Int

gesture-tap

Tap gesture

Int

gesture-doubletap

Double tap gesture

Int

gesture-hold

Hold gesture

Int

gesture-drag

Drag gesture

Int

gesture-swipe-right

Swipe right gesture

Int

gesture-swipe-left

Swipe left gesture

Int

gesture-swipe-up

Swipe up gesture

Int

gesture-swipe-down

Swipe down gesture

Int

gesture-pinch-in

Pinch in gesture

Int

gesture-pinch-out

Pinch out gesture

Int

is-key-pressed?

Check if a key was pressed once (not held)

Int -> Bool

is-key-down?

Check if a key is being held down

Int -> Bool

is-key-released?

Check if a key was released once

Int -> Bool

is-key-up?

Check if a key is NOT being pressed

Int -> Bool

is-key-pressed-repeat?

Check if a key has been pressed again (key repeat)

Int -> Bool

get-key-pressed

Get the last key pressed (queue-based)

Int

get-char-pressed

Get the last character pressed (unicode, queue-based)

Int

set-exit-key

Set a custom key to exit the application (default is ESC)

Int -> Void

is-mouse-button-pressed?

Check if a mouse button was pressed once

Int -> Bool

is-mouse-button-down?

Check if a mouse button is being held down

Int -> Bool

is-mouse-button-released?

Check if a mouse button was released once

Int -> Bool

is-mouse-button-up?

Check if a mouse button is NOT being pressed

Int -> Bool

get-mouse-x

Get mouse position X

Int

get-mouse-y

Get mouse position Y

Int

get-mouse-position

Get mouse position as a record {x, y}

{x: Float, y: Float}

set-mouse-position

Set mouse position

Int -> Int -> Void

get-mouse-delta

Get mouse delta (movement since last frame) as a record {x, y}

{x: Float, y: Float}

get-mouse-wheel

Get mouse wheel movement (vertical)

Float

get-mouse-wheel-move

Get mouse wheel movement (vertical) - alias

Float

get-mouse-wheel-move-x

Get mouse wheel horizontal movement

Float

get-mouse-wheel-move-y

Get mouse wheel vertical movement

Float

show-cursor

Show cursor

Void

hide-cursor

Hide cursor

Void

enable-cursor

Enable cursor (unlock cursor)

Void

disable-cursor

Disable cursor (lock cursor)

Void

set-mouse-cursor

Set mouse cursor type

Int -> Void

set-mouse-scale

Set mouse scaling (for high-DPI displays)

Float -> Float -> Void

set-mouse-offset

Set mouse offset (for virtual resolution)

Int -> Int -> Void

is-gamepad-available?

Check if a gamepad is connected

Int -> Bool

get-gamepad-name

Get internal name of the gamepad

Int -> String

is-gamepad-button-pressed?

Check if a gamepad button was pressed once

Int -> Int -> Bool

is-gamepad-button-down?

Check if a gamepad button is being held down

Int -> Int -> Bool

is-gamepad-button-released?

Check if a gamepad button was released once

Int -> Int -> Bool

is-gamepad-button-up?

Check if a gamepad button is NOT being pressed

Int -> Int -> Bool

get-gamepad-button-pressed

Get the last gamepad button pressed

Int

get-gamepad-axis-count

Get gamepad axis count for a gamepad

Int -> Int

get-gamepad-axis-movement

Get axis movement value for a gamepad axis (-1.0 to 1.0)

Int -> Int -> Float

set-gamepad-mappings

Set internal gamepad mappings (SDL_GameControllerDB)

String -> Int

set-gamepad-vibration

Set gamepad vibration for both motors (duration in seconds)

Int -> Float -> Float -> Float -> Void

get-touch-x

Get touch position X for first touch point

Int

get-touch-y

Get touch position Y for first touch point

Int

get-touch-point-id

Get touch point identifier for a given index

Int -> Int

get-touch-point-count

Get number of touch points

Int

get-touch-position

Get touch position for a given touch point index as a record {x, y}

Int -> {x: Float, y: Float}

set-gestures-enabled

Enable a set of gestures using gesture flags

Int -> Void

is-gesture-detected?

Check if a gesture has been detected

Int -> Bool

get-gesture-detected

Get latest detected gesture

Int

get-gesture-hold-duration

Get gesture hold time in seconds

Float

get-gesture-drag-angle

Get gesture drag angle

Float

get-gesture-pinch-angle

Get gesture pinch angle

Float

get-gesture-drag-vector

Get gesture drag vector as a record {x, y}

{x: Float, y: Float}

get-gesture-pinch-vector

Get gesture pinch vector as a record {x, y}

{x: Float, y: Float}

Color type with RGBA components (0-255 for each channel)

2D Vector with x and y components

Rectangle defined by position (x, y) and dimensions (width, height)

Texture loaded in GPU memory (VRAM)

Sound source loaded in memory

Music stream that can be played continuously

Font with associated base size for text rendering

Render texture for offscreen rendering

Image loaded in CPU memory (RAM)

Shader program for GPU rendering effects

2D Camera with offset, target, rotation and zoom

3D Camera with position, target, up vector, field of view and projection type

3D Model with meshes, materials and transform

Mesh vertex data for 3D rendering

run-game

Simple game loop helper init: initialization function called once at startup update: update function called each frame for game logic draw: draw function called each frame for rendering

(() -> a) -> (() -> b) -> (() -> c) -> Void

vec2

Create a 2D vector from x and y components

Float -> Float -> {x: Float, y: Float}

vec2-add

Add two 2D vectors component-wise

{x: Float, y: Float} -> {x: Float, y: Float} -> {x: Float, y: Float}

vec2-sub

Subtract vector b from vector a component-wise

{x: Float, y: Float} -> {x: Float, y: Float} -> {x: Float, y: Float}

vec2-scale

Scale a vector by a scalar value

{x: Float, y: Float} -> Float -> {x: Float, y: Float}

vec2-length

Calculate the length (magnitude) of a vector

{x: Float, y: Float} -> Float

vec2-normalize

Normalize a vector to unit length Returns the original vector if length is zero to avoid division by zero

{x: Float, y: Float} -> {x: Float, y: Float}

rect

Create a rectangle from position and dimensions

Float -> Float -> Float -> Float -> {x: Float, y: Float, width: Float, height: Float}

rect-contains?

Check if a point (px, py) is contained within a rectangle

{x: Float, y: Float, width: Float, height: Float} -> Float -> Float -> Bool

rects-overlap?

Check if two rectangles overlap (collision detection)

{x: Float, y: Float, width: Float, height: Float} -> {x: Float, y: Float, width: Float, height: Float} -> Bool

load-texture

NonEmptyString -> Ptr

unload-texture

Ptr -> Void

draw-texture

Ptr -> Int -> Int -> Int -> Void

draw-texture-ex

Ptr -> Float -> Float -> Float -> Float -> Int -> Void

texture-width

Ptr -> Int

texture-height

Ptr -> Int

draw-texture-rec

Ptr -> Float -> Float -> Float -> Float -> Float -> Float -> Int -> Void

draw-texture-pro

Ptr -> Float -> Float -> Float -> Float -> Float -> Float -> Float -> Float -> Float -> Float -> Float -> Int -> Void

gen-texture-mipmaps

Ptr -> Void

set-texture-filter

Ptr -> Int -> Void

set-texture-wrap

Ptr -> Int -> Void

load-render-texture

PositiveInt -> PositiveInt -> Ptr

unload-render-texture

Ptr -> Void

begin-texture-mode

Ptr -> Void

end-texture-mode

Void

render-texture-width

Ptr -> Int

render-texture-height

Ptr -> Int

draw-render-texture-pro

Ptr -> Float -> Float -> Int -> Int -> Float -> Float -> Float -> Float -> Float -> Float -> Float -> Color -> Void

draw-render-texture-pro target 0.0 0.0 256 -256 100.0 100.0 256.0 256.0 0.0 0.0 0.0 white

load-image

NonEmptyString -> Ptr

unload-image

Ptr -> Void

is-image-valid?

Ptr -> Bool

image-width

Ptr -> Int

image-height

Ptr -> Int

export-image?

Ptr -> NonEmptyString -> Bool

image-copy

Ptr -> Ptr

image-from-image

Ptr -> Float -> Float -> Float -> Float -> Ptr

load-image-from-texture

Ptr -> Ptr

load-image-from-screen

Ptr

load-texture-from-image

Ptr -> Ptr

image-crop

Ptr -> Float -> Float -> Float -> Float -> Void

image-alpha-crop

Ptr -> Float -> Void

image-alpha-clear

Ptr -> Int -> Float -> Void

image-alpha-premultiply

Ptr -> Void

image-alpha-mask

Ptr -> Ptr -> Void

image-mipmaps

Ptr -> Void

image-dither

Ptr -> Int -> Int -> Int -> Int -> Void

image-resize-canvas

Ptr -> PositiveInt -> PositiveInt -> Int -> Int -> Int -> Void

image-format

Ptr -> Int -> Void

image-to-pot

Ptr -> Int -> Void

image-from-channel

Ptr -> Int -> Ptr

image-flip-vertical

Ptr -> Void

image-flip-horizontal

Ptr -> Void

image-rotate

Ptr -> Int -> Void

image-rotate-cw

Ptr -> Void

image-rotate-ccw

Ptr -> Void

image-resize

Ptr -> PositiveInt -> PositiveInt -> Void

image-resize-nn

Ptr -> PositiveInt -> PositiveInt -> Void

image-color-tint

Ptr -> Int -> Void

image-color-invert

Ptr -> Void

image-color-grayscale

Ptr -> Void

image-color-contrast

Ptr -> Float -> Void

image-color-brightness

Ptr -> Int -> Void

image-color-replace

Ptr -> Int -> Int -> Void

image-blur-gaussian

Ptr -> PositiveInt -> Void

gen-image-color

PositiveInt -> PositiveInt -> Int -> Ptr

gen-image-gradient-linear

PositiveInt -> PositiveInt -> Int -> Int -> Int -> Ptr

gen-image-gradient-radial

PositiveInt -> PositiveInt -> Float -> Int -> Int -> Ptr

gen-image-gradient-square

PositiveInt -> PositiveInt -> Float -> Int -> Int -> Ptr

gen-image-checked

PositiveInt -> PositiveInt -> PositiveInt -> PositiveInt -> Int -> Int -> Ptr

gen-image-white-noise

PositiveInt -> PositiveInt -> Float -> Ptr

gen-image-perlin-noise

PositiveInt -> PositiveInt -> Int -> Int -> Float -> Ptr

gen-image-cellular

PositiveInt -> PositiveInt -> PositiveInt -> Ptr

gen-image-text

PositiveInt -> PositiveInt -> String -> Ptr

image-text

String -> PositiveInt -> Int -> Ptr

image-text-ex

Ptr -> String -> PositiveFloat -> Float -> Int -> Ptr

image-clear-background

Ptr -> Int -> Void

image-draw-pixel

Ptr -> Int -> Int -> Int -> Void

image-draw-line

Ptr -> Int -> Int -> Int -> Int -> Int -> Void

image-draw-circle

Ptr -> Int -> Int -> Int -> Int -> Void

image-draw-circle-lines

Ptr -> Int -> Int -> Int -> Int -> Void

image-draw-rectangle

Ptr -> Int -> Int -> Int -> Int -> Int -> Void

image-draw-rectangle-lines

Ptr -> Int -> Int -> Int -> Int -> Int -> Int -> Void

image-draw

Ptr -> Ptr -> Float -> Float -> Float -> Float -> Float -> Float -> Float -> Float -> Int -> Void

image-draw-text

Ptr -> String -> Int -> Int -> PositiveInt -> Int -> Void

image-draw-text-ex

Ptr -> Ptr -> String -> Float -> Float -> PositiveFloat -> Float -> Int -> Void

image-draw-triangle

Ptr -> Float -> Float -> Float -> Float -> Float -> Float -> Int -> Void

image-draw-triangle-ex

Ptr -> Float -> Float -> Float -> Float -> Float -> Float -> Int -> Int -> Int -> Void

image-draw-triangle-lines

Ptr -> Float -> Float -> Float -> Float -> Float -> Float -> Int -> Void

draw-texture-n-patch

Ptr -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Float -> Float -> Float -> Float -> Float -> Float -> Float -> Int -> Void

texture-filter-point

No filter, just pixel approximation

Int

texture-filter-bilinear

Linear filtering

Int

texture-filter-trilinear

Trilinear filtering (linear with mipmaps)

Int

texture-filter-anisotropic-4x

Anisotropic filtering 4x

Int

texture-filter-anisotropic-8x

Anisotropic filtering 8x

Int

texture-filter-anisotropic-16x

Anisotropic filtering 16x

Int

texture-wrap-repeat

Repeats texture in tiled mode

Int

texture-wrap-clamp

Clamps texture to edge pixel in tiled mode

Int

texture-wrap-mirror-repeat

Mirrors and repeats the texture in tiled mode

Int

texture-wrap-mirror-clamp

Mirrors and clamps to border the texture in tiled mode

Int

npatch-nine-patch

9-patch layout: 3x3 tiles

Int

npatch-three-patch-vertical

3-patch vertical layout: 1x3 tiles

Int

npatch-three-patch-horizontal

3-patch horizontal layout: 3x1 tiles

Int

pixelformat-uncompressed-grayscale

8 bit per pixel grayscale (no alpha)

Int

pixelformat-uncompressed-gray-alpha

8*2 bpp grayscale with alpha (2 channels)

Int

pixelformat-uncompressed-r5g6b5

16 bpp RGB (5-6-5)

Int

pixelformat-uncompressed-r8g8b8

24 bpp RGB (8-8-8)

Int

pixelformat-uncompressed-r5g5b5a1

16 bpp RGBA (5-5-5-1 with 1 bit alpha)

Int

pixelformat-uncompressed-r4g4b4a4

16 bpp RGBA (4-4-4-4 with 4 bit alpha)

Int

pixelformat-uncompressed-r8g8b8a8

32 bpp RGBA (8-8-8-8 with full alpha)

Int

filter-point

Point filtering (nearest neighbor), no anti-aliasing

filter-bilinear

Bilinear filtering for smooth anti-aliased text

filter-trilinear

Trilinear filtering (linear with mipmaps)

filter-anisotropic-4x

Anisotropic filtering 4x

filter-anisotropic-8x

Anisotropic filtering 8x

filter-anisotropic-16x

Anisotropic filtering 16x

draw-text

Draw text using the default font.

Parameters:

  • text - The string to draw
  • x - X position on screen (pixels)
  • y - Y position on screen (pixels)
  • font-size - Size of the font in pixels
  • color - Text color as an integer (use Raylib color functions)

String -> Int -> Int -> PositiveInt -> Int -> Void

draw-text "Hello, World!" 10 10 20 Raylib.white

measure-text

Measure the width of text using the default font.

Parameters:

  • text - The string to measure
  • font-size - Size of the font in pixels

Returns: Int - Width of the text in pixels

String -> PositiveInt -> Int

width = measure-text "Hello" 20

load-font

Load a font from file.

Supports TTF and other common font formats.

Parameters:

  • path - Path to the font file

Returns: Option Font - Some Font if loading succeeded, None if failed

NonEmptyString -> Option {ptr: Ptr, base-size: Int}

font = load-font "assets/myfont.ttf"
match font
  | Some f -> draw-text-ex f "Hello" 10 10 24.0 2.0 color
  | None -> print "Failed to load font"

load-font-ex

Load a font with specific size and glyph count.

Parameters:

  • path - Path to the font file
  • font-size - Desired font size (affects quality)
  • glyph-count - Number of glyphs to load (0 for default)

Returns: Option Font - Some Font if loading succeeded, None if failed

NonEmptyString -> PositiveInt -> Int -> Option {ptr: Ptr, base-size: Int}

font = load-font-ex "assets/myfont.ttf" 32 0

unload-font

Unload a font from memory.

Parameters:

  • font - The font to unload

{ptr: Ptr, base-size: Int} -> Void

unload-font font

font-base-size

Get the base size a font was loaded at.

Parameters:

  • font - The loaded font

Returns: Int - Base font size in pixels

{ptr: Ptr, base-size: Int} -> Int

size = font-base-size font

set-font-filter

Set texture filter for a font (for anti-aliasing).

Use filter-bilinear for smooth anti-aliased text.

Parameters:

  • font - The font to configure
  • filter - Filter type (use filter-* constants)

{ptr: Ptr, base-size: Int} -> Int -> Void

set-font-filter font filter-bilinear

draw-text-ex

Draw text using a custom font.

Parameters:

  • font - The loaded font
  • text - String to draw
  • x - X position on screen
  • y - Y position on screen
  • font-size - Size to render at (Float for precision)
  • spacing - Character spacing
  • color - Text color

{ptr: Ptr, base-size: Int} -> String -> Int -> Int -> PositiveFloat -> Float -> Int -> Void

draw-text-ex font "Hello" 10 50 24.0 2.0 Raylib.white

measure-text-ex

Measure text width using a custom font.

Parameters:

  • font - The loaded font
  • text - String to measure
  • font-size - Size to measure at
  • spacing - Character spacing

Returns: Int - Width of the text in pixels

{ptr: Ptr, base-size: Int} -> String -> PositiveFloat -> Float -> Int

width = measure-text-ex font "Hello" 24.0 2.0

get-font-default

Get the default font.

Returns the built-in raylib default font. Useful when you need a font object but don't want to load a custom font.

Returns: Font - The default font

{ptr: Ptr, base-size: Int}

font = get-font-default

is-font-valid?

Check if a font is valid.

Parameters:

  • font - The font to check

Returns: Bool - true if the font is valid, false otherwise

{ptr: Ptr, base-size: Int} -> Bool

if is-font-valid? font then draw-text-ex font ...

export-font-as-code?

Export font as C code file.

Generates a C header file containing the font data that can be compiled into an application.

Parameters:

  • font - The font to export
  • file-name - Output file path

Returns: Bool - true if export succeeded, false otherwise

{ptr: Ptr, base-size: Int} -> NonEmptyString -> Bool

success = export-font-as-code? font "myfont.h"

draw-text-pro

Draw text with rotation.

Draws text with full control over positioning, rotation, and origin.

Parameters:

  • font - The loaded font
  • text - String to draw
  • pos-x - X position
  • pos-y - Y position
  • origin-x - Rotation origin X
  • origin-y - Rotation origin Y
  • rotation - Rotation angle in degrees
  • font-size - Font size
  • spacing - Character spacing
  • tint - Text color

{ptr: Ptr, base-size: Int} -> String -> Float -> Float -> Float -> Float -> Float -> PositiveFloat -> Float -> Int -> Void

draw-text-pro font "Rotated!" 100.0 100.0 0.0 0.0 45.0 24.0 2.0 color

draw-text-codepoint

Draw a single codepoint.

Draws a single Unicode character at the specified position.

Parameters:

  • font - The loaded font
  • codepoint - Unicode codepoint to draw
  • pos-x - X position
  • pos-y - Y position
  • font-size - Font size
  • tint - Text color

{ptr: Ptr, base-size: Int} -> Int -> Float -> Float -> PositiveFloat -> Int -> Void

draw-text-codepoint font 65 100.0 100.0 24.0 color  # Draws 'A'

set-text-line-spacing

Set vertical line spacing for text.

Parameters:

  • spacing - Line spacing in pixels

Int -> Void

set-text-line-spacing 24

get-glyph-index

Get glyph index in font.

Parameters:

  • font - The loaded font
  • codepoint - Unicode codepoint

Returns: Int - Index of the glyph in the font

{ptr: Ptr, base-size: Int} -> Int -> Int

index = get-glyph-index font 65  # Get index for 'A'

get-codepoint-count

Get codepoint count in UTF-8 text.

Parameters:

  • text - UTF-8 string

Returns: Int - Number of codepoints in the string

String -> Int

count = get-codepoint-count "Hello"  # Returns 5

text-to-integer

Parse text to integer.

Parameters:

  • text - String containing a number

Returns: Int - Parsed integer value

String -> Int

num = text-to-integer "42"  # Returns 42

text-to-float

Parse text to float.

Parameters:

  • text - String containing a number

Returns: Float - Parsed float value

String -> Float

num = text-to-float "3.14"  # Returns 3.14

text-find-index

Find text in string.

Parameters:

  • text - String to search in
  • search - String to search for

Returns: Int - Index of first occurrence, or -1 if not found

String -> String -> Int

index = text-find-index "Hello World" "World"  # Returns 6

text-is-equal?

Check if two strings are equal.

Parameters:

  • text1 - First string
  • text2 - Second string

Returns: Bool - true if strings are equal

String -> String -> Bool

if text-is-equal? "foo" "foo" then print "Match!"

text-length

Get text length.

Parameters:

  • text - String to measure

Returns: Int - Length of the string in bytes

String -> Int

len = text-length "Hello"  # Returns 5

load-file-text

Load text from file.

Parameters:

  • file-name - Path to the text file

Returns: String - Contents of the file

NonEmptyString -> String

content = load-file-text "data.txt"

save-file-text?

Save text to file.

Parameters:

  • file-name - Output file path
  • text - Text content to save

Returns: Bool - true if save succeeded

NonEmptyString -> String -> Bool

success = save-file-text? "output.txt" "Hello, World!"

load-font-from-image

Load font from image.

Creates a font from an image containing character glyphs.

Parameters:

  • image - Image containing font glyphs
  • key - Color key for transparency
  • first-char - First character code in the image

Returns: Option Font - Some Font if successful, None otherwise

{ptr: Ptr} -> Int -> Int -> Option {ptr: Ptr, base-size: Int}

font = load-font-from-image img 0xFF00FF 32

get-glyph-atlas-rec-x

Get glyph atlas rectangle X coordinate.

Parameters:

  • font - The loaded font
  • codepoint - Unicode codepoint

Returns: Int - X coordinate in the atlas texture

{ptr: Ptr, base-size: Int} -> Int -> Int

x = get-glyph-atlas-rec-x font 65

get-glyph-atlas-rec-y

Get glyph atlas rectangle Y coordinate.

Parameters:

  • font - The loaded font
  • codepoint - Unicode codepoint

Returns: Int - Y coordinate in the atlas texture

{ptr: Ptr, base-size: Int} -> Int -> Int

y = get-glyph-atlas-rec-y font 65

get-glyph-atlas-rec-width

Get glyph atlas rectangle width.

Parameters:

  • font - The loaded font
  • codepoint - Unicode codepoint

Returns: Int - Width of the glyph in the atlas

{ptr: Ptr, base-size: Int} -> Int -> Int

width = get-glyph-atlas-rec-width font 65

get-glyph-atlas-rec-height

Get glyph atlas rectangle height.

Parameters:

  • font - The loaded font
  • codepoint - Unicode codepoint

Returns: Int - Height of the glyph in the atlas

{ptr: Ptr, base-size: Int} -> Int -> Int

height = get-glyph-atlas-rec-height font 65

get-font-glyph-count

Get font glyph count.

Parameters:

  • font - The loaded font

Returns: Int - Number of glyphs in the font

{ptr: Ptr, base-size: Int} -> Int

count = get-font-glyph-count font

image-draw-text

Draw text on an image.

Parameters:

  • img - Target image to draw on
  • text - Text to draw
  • pos-x - X position in pixels
  • pos-y - Y position in pixels
  • font-size - Font size
  • color - Text color

{ptr: Ptr} -> String -> Int -> Int -> PositiveInt -> Int -> Void

image-draw-text img "Hello" 10 10 20 color

image-draw-text-ex

Draw text on an image using a custom font.

Parameters:

  • img - Target image to draw on
  • font - Font to use
  • text - Text to draw
  • pos-x - X position
  • pos-y - Y position
  • font-size - Font size
  • spacing - Character spacing
  • tint - Text color

{ptr: Ptr} -> {ptr: Ptr, base-size: Int} -> String -> Float -> Float -> PositiveFloat -> Float -> Int -> Void

image-draw-text-ex img font "Hello" 10.0 10.0 24.0 2.0 color

gen-image-text

Generate an image with text.

Creates an image of specified size containing rendered text.

Parameters:

  • width - Image width
  • height - Image height
  • text - Text to render

Returns: Option Image - Some Image if successful, None otherwise

PositiveInt -> PositiveInt -> String -> Option {ptr: Ptr, width: Int, height: Int}

img = gen-image-text 200 50 "Hello"

image-text

Create an image from text using default font.

Parameters:

  • text - Text to render
  • font-size - Font size
  • color - Text color

Returns: Option Image - Some Image if successful, None otherwise

String -> PositiveInt -> Int -> Option {ptr: Ptr, width: Int, height: Int}

img = image-text "Hello" 20 color

image-text-ex

Create an image from text using a custom font.

Parameters:

  • font - Font to use
  • text - Text to render
  • font-size - Font size
  • spacing - Character spacing
  • tint - Text color

Returns: Option Image - Some Image if successful, None otherwise

{ptr: Ptr, base-size: Int} -> String -> PositiveFloat -> Float -> Int -> Option {ptr: Ptr, width: Int, height: Int}

img = image-text-ex font "Hello" 24.0 2.0 color

log-all

Display all logs

Int

log-trace

Trace logging, intended for internal use only

Int

log-debug

Debug logging, used for internal debugging

Int

log-info

Info logging, used for program execution info

Int

log-warning

Warning logging, used on recoverable failures

Int

log-error

Error logging, used on unrecoverable failures

Int

log-fatal

Fatal logging, used to abort program

Int

log-none

Disable logging

Int

flag-vsync-hint

Set to try enabling V-Sync on GPU

Int

flag-fullscreen-mode

Set to run program in fullscreen

Int

flag-window-resizable

Set to allow resizable window

Int

flag-window-undecorated

Set to disable window decoration (frame and buttons)

Int

flag-window-hidden

Set to hide window

Int

flag-window-minimized

Set to minimize window (iconify)

Int

flag-window-maximized

Set to maximize window (expanded to monitor)

Int

flag-window-unfocused

Set to window non-focused

Int

flag-window-topmost

Set to window always on top

Int

flag-window-always-run

Set to allow windows running while minimized

Int

flag-window-transparent

Set to allow transparent framebuffer

Int

flag-window-highdpi

Set to support HighDPI

Int

flag-msaa-4x-hint

Set to try enabling MSAA 4X

Int

set-trace-log-level

Set the minimum log level for raylib's internal logging.

Parameters:

  • log-warning, log-error, log-fatal, log-none)

Int -> Void

# Only show warnings and errors
Core.set-trace-log-level Core.log-warning

# Disable all raylib logging
Core.set-trace-log-level Core.log-none

set-trace-log-json

Set raylib logging to output JSON formatted logs.

This enables raylib logs to be output in JSON format, compatible with kit-logging's JsonFmt format. Each log entry includes timestamp, level, message, and source fields.

Call this before init-window to capture all raylib startup logs.

Void

Core.set-trace-log-json()
Core.init-window 800 600 "My Game"
# Raylib logs now appear as JSON:
# {"timestamp":"2024-01-15T10:30:45","level":"info","message":"Initializing raylib...","source":"raylib"}

set-trace-log-pretty

Set raylib logging to output pretty formatted logs.

This enables raylib logs to be output in a human-readable format with colors, compatible with kit-logging's PrettyFmt format. Each log entry includes timestamp, colored level, source tag, and message.

Call this before init-window to capture all raylib startup logs.

Void

Core.set-trace-log-pretty()
Core.init-window 800 600 "My Game"
# Raylib logs now appear as:
# 2024-01-15T10:30:45 INFO  [raylib] Initializing raylib...

set-trace-log-file

Set raylib logging to write JSON formatted logs to a file.

This enables raylib logs to be written to a file in JSON format, compatible with kit-logging's FileLogger format. Logs are appended to the file if it exists.

Call this before init-window to capture all raylib startup logs. Call reset-trace-log to close the file when done.

NonEmptyString -> Void

Core.set-trace-log-file "raylib.log"
Core.init-window 800 600 "My Game"
# Raylib logs are now written to raylib.log in JSON format

Core.close-window()
Core.reset-trace-log()  # Close the log file

set-trace-log-no-op

Set raylib logging to discard all logs (no-op).

This silently discards all raylib log messages without any output. Similar to kit-logging's NoOpLogger behavior.

Useful when you want to completely suppress raylib's internal logging without affecting the log level setting.

Void

Core.set-trace-log-no-op()
Core.init-window 800 600 "My Game"
# No raylib logs will be output

reset-trace-log

Reset raylib logging to its default behavior.

Restores raylib's internal trace log handler after using set-trace-log-json, set-trace-log-pretty, set-trace-log-file, or set-trace-log-no-op.

If a log file was opened with set-trace-log-file, it will be closed.

Void

Core.set-trace-log-json()
# ... do some operations with JSON logging ...
Core.reset-trace-log()
# Back to raylib's default logging

activate-app

Activate the application on macOS to bring windows to foreground.

On macOS, when running GUI code via an interpreter (like kit run), the window may be created but not visible because the process isn't properly activated as a foreground GUI application.

Call this function after init-window if the window doesn't appear. This is a no-op on non-macOS platforms, so it's safe to call unconditionally.

Void

Core.init-window 800 600 "My Game"
Core.activate-app()  # Ensure window is visible on macOS

init-window

Initialize window and OpenGL context.

Parameters:

PositiveInt -> PositiveInt -> NonEmptyString -> Void

Core.init-window 800 600 "My Game"

close-window

Close window and unload OpenGL context.

Void

Core.close-window()

window-should-close?

Check if window should close (ESC key or close button pressed).

Returns 1 if window should close, 0 otherwise.

Bool

while not Core.window-should-close? do
  # game loop

is-window-ready?

Check if window has been initialized successfully.

Returns true if window is ready, false otherwise.

Bool

is-window-fullscreen?

Check if window is currently fullscreen.

Returns true if fullscreen, false otherwise.

Bool

is-window-hidden?

Check if window is currently hidden.

Returns true if hidden, false otherwise.

Bool

is-window-minimized?

Check if window is currently minimized.

Returns true if minimized, false otherwise.

Bool

is-window-maximized?

Check if window is currently maximized.

Returns true if maximized, false otherwise.

Bool

is-window-focused?

Check if window is currently focused.

Returns true if focused, false otherwise.

Bool

is-window-resized?

Check if window has been resized since last frame.

Returns true if resized, false otherwise.

Bool

is-window-state?

Check if a specific window state flag is enabled.

Returns true if flag is set, false otherwise.

Int -> Bool

toggle-fullscreen

Toggle fullscreen mode.

Void

toggle-borderless-windowed

Toggle borderless windowed mode.

Void

maximize-window

Maximize window (only for resizable windows).

Void

minimize-window

Minimize window.

Void

restore-window

Restore window to previous state (from minimized/maximized).

Void

set-window-title

Set window title.

String -> Void

set-window-position

Set window position on screen.

Int -> Int -> Void

set-window-min-size

Set window minimum dimensions (for resizable windows).

PositiveInt -> PositiveInt -> Void

set-window-max-size

Set window maximum dimensions (for resizable windows).

PositiveInt -> PositiveInt -> Void

set-window-size

Set window dimensions.

PositiveInt -> PositiveInt -> Void

set-window-opacity

Set window opacity (0.0 transparent to 1.0 opaque).

UnitFloat -> Void

set-window-focused

Set window as focused.

Void

set-window-monitor

Set monitor for the current window.

Int -> Void

set-config-flags

Set configuration flags before window creation. Call this BEFORE init-window to configure window properties.

Int -> Void

set-window-state

Set window state flags after window creation. Can be used to make window resizable, fullscreen, etc.

Int -> Void

clear-window-state

Clear window state flags.

Int -> Void

get-screen-width

Get screen width in pixels.

Int

get-screen-height

Get screen height in pixels.

Int

get-render-width

Get current render width (considers HiDPI).

Int

get-render-height

Get current render height (considers HiDPI).

Int

get-monitor-count

Get number of connected monitors.

Int

get-current-monitor

Get current monitor where window is placed.

Int

get-monitor-width

Get specified monitor width.

Int -> Int

get-monitor-height

Get specified monitor height.

Int -> Int

get-monitor-physical-width

Get specified monitor physical width in millimetres.

Int -> Int

get-monitor-physical-height

Get specified monitor physical height in millimetres.

Int -> Int

get-monitor-refresh-rate

Get specified monitor refresh rate.

Int -> Int

get-monitor-name

Get the human-readable name of the specified monitor.

Int -> String

get-window-handle

Get native window handle.

Ptr

set-clipboard-text

Set clipboard text content.

String -> Void

get-clipboard-text

Get clipboard text content.

String

enable-event-waiting

Enable waiting for events on EndDrawing (no automatic event polling).

Void

disable-event-waiting

Disable waiting for events (automatic event polling).

Void

begin-drawing

Setup canvas (framebuffer) to start drawing.

Void

end-drawing

End canvas drawing and swap buffers (double buffering).

Void

clear-background

Set background color (clears the framebuffer).

Parameters:

    Int -> Void

set-target-fps

Set target FPS (maximum).

PositiveInt -> Void

get-fps

Get current FPS.

Int

get-frame-time

Get time since last frame in seconds.

Float

get-time

Get elapsed time since init-window in seconds.

Float

wait-time

Wait for some time (halt program execution).

Parameters:

    Float -> Void

swap-screen-buffer

Swap back buffer with front buffer (screen drawing). Used for manual frame control.

Void

poll-input-events

Register all input events. Used for manual frame control.

Void

draw-fps

Draw current FPS at the given position.

Int -> Int -> Void

show-cursor

Show cursor.

Void

hide-cursor

Hide cursor.

Void

is-cursor-hidden?

Check if cursor is hidden.

Returns true if hidden, false otherwise.

Bool

enable-cursor

Enable cursor (unlock cursor).

Void

disable-cursor

Disable cursor (lock cursor).

Void

is-cursor-on-screen?

Check if cursor is on screen.

Returns true if on screen, false otherwise.

Bool

take-screenshot

Take a screenshot of current screen (saved to file).

Parameters:

    NonEmptyString -> Void

open-url

Open URL with default system browser.

Parameters:

    NonEmptyString -> Void

begin-mode-2d

Float -> Float -> Float -> Float -> Float -> Float -> Void

end-mode-2d

Void

get-screen-to-world-2d

Float -> Float -> Float -> Float -> Float -> Float -> Float -> Float -> Ptr -> Ptr -> Void

get-world-to-screen-2d

Float -> Float -> Float -> Float -> Float -> Float -> Float -> Float -> Ptr -> Ptr -> Void

begin-mode-3d

{pos-x: Float, pos-y: Float, pos-z: Float, target-x: Float, target-y: Float, target-z: Float, up-x: Float, up-y: Float, up-z: Float, fovy: Float, projection: Int} -> Void

end-mode-3d

Void

update-camera

Ptr -> Int -> Void

update-camera-pro

Ptr -> Float -> Float -> Float -> Float -> Float -> Float -> Float -> Void

get-camera-forward-x

Ptr -> Float

get-camera-forward-y

Ptr -> Float

get-camera-forward-z

Ptr -> Float

get-camera-up-x

Ptr -> Float

get-camera-up-y

Ptr -> Float

get-camera-up-z

Ptr -> Float

get-camera-right-x

Ptr -> Float

get-camera-right-y

Ptr -> Float

get-camera-right-z

Ptr -> Float

camera-move-forward

Ptr -> Float -> Int -> Void

camera-move-up

Ptr -> Float -> Void

camera-move-right

Ptr -> Float -> Int -> Void

camera-move-to-target

Ptr -> Float -> Void

camera-yaw

Ptr -> Float -> Int -> Void

camera-pitch

Ptr -> Float -> Int -> Int -> Int -> Void

camera-roll

Ptr -> Float -> Void

camera-custom

Custom camera mode (manual control).

camera-free

Free camera mode (free movement).

camera-orbital

Orbital camera mode (orbits around target).

camera-first-person

First person camera mode.

camera-third-person

Third person camera mode.

camera-perspective

Perspective projection (3D depth).

camera-orthographic

Orthographic projection (no depth).

camera-3d-perspective

Create a 3D camera with perspective projection.

Returns a record containing camera parameters that can be used with begin-mode-3d.

Parameters:

Float -> Float -> Float -> Float -> Float -> Float -> Float -> {pos-x: Float, pos-y: Float, pos-z: Float, target-x: Float, target-y: Float, target-z: Float, up-x: Float, up-y: Float, up-z: Float, fovy: Float, projection: Int}

camera = Camera.camera-3d-perspective 0.0 10.0 10.0 0.0 0.0 0.0 45.0
Camera.begin-mode-3d camera

camera-3d-orthographic

Create a 3D camera with orthographic projection.

Returns a record containing camera parameters.

Float -> Float -> Float -> Float -> Float -> Float -> Float -> {pos-x: Float, pos-y: Float, pos-z: Float, target-x: Float, target-y: Float, target-z: Float, up-x: Float, up-y: Float, up-z: Float, fovy: Float, projection: Int}

make-camera-2d

Create a 2D camera.

Returns a record containing 2D camera parameters.

Parameters:

    Float -> Float -> Float -> Float -> Float -> Float -> {offset-x: Float, offset-y: Float, target-x: Float, target-y: Float, rotation: Float, zoom: Float}