You are looking at historical revision 45122 of this page. It may differ significantly from its current revision.

raylib

Description

Bindings to the raylib game library version 5.5. These are not complete yet, but all of the functions I commonly use are ported over. It's a very thin wrapper around the raylib C library that hopefully has minimal performance drawbacks.

Types such as Vector2, Vector3, and Rectangle are represented as SRFI-4 vectors to keep the memory managed by CHICKEN.

Requirements

Documentation

Vector Interface

[procedure] (make-vec2 X Y)
[procedure] (vec2-x V)
[procedure] (vec2-y V)
[procedure] (make-vec3 X Y Z)
[procedure] (vec3-x V)
[procedure] (vec3-y V)
[procedure] (vec3-z V)

Represented as f32vector.

Texture Interface

[procedure] (make-texture)
[procedure] (free-texture TEXTURE)

Allocates C struct in unmanaged memory (C_malloc). Remember to free.

[procedure] (texture-id TEXTURE)
[procedure] (texture-width TEXTURE)
[procedure] (texture-height TEXTURE)
[procedure] (texture-mipmaps TEXTURE)
[procedure] (texture-format TEXTURE)

Camera2D Interface

[procedure] (make-camera2d)
[procedure] (free-camera2d TEXTURE)

Allocates C struct in unmanaged memory (C_malloc). Remember to free.

[procedure] (camera2d-offset CAMERA)
[procedure] (camera2d-target CAMERA)

Return f32vector (Vector2).

[procedure] (camera2d-rotation CAMERA)
[procedure] (camera2d-zoom CAMERA)

Return flonum.

[procedure] (camera2d-offset-set! CAMERA VEC2)
[procedure] (camera2d-target-set! CAMERA VEC2)
[procedure] (camera2d-rotation-set! CAMERA ROTATION)
[procedure] (camera2d-zoom-set! CAMERA ZOOM)

Set the specified slots.

Constants

The following are defined from raylib.h:

General Interface

Example

(import raylib)

(init-window 800 450 "raylib [core] example - basic window")

(let loop ()
  (begin-drawing)
  (clear-background RAYWHITE)
  (draw-text "Congrats! You created your first window!"
             190
             200
             20
             LIGHTGRAY)
  (end-drawing)
  (if (window-should-close?) #f (loop)))

(close-window)

Source repository

https://github.com/meowstr/chicken-raylib

Feel free to open issues and PR's!

Authors

Meowster

License

MIT