You are looking at historical revision 45123 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 Color, Vector2, Vector3, and Rectangle are represented as SRFI-4 vectors to keep the memory managed by CHICKEN.
Requirements
- foreigners
- raylib c library (should be visible via -lraylib)
Documentation
Color Interface
[procedure] (make-color R G B A)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:
- Colors (e.g. LIGHTGRAY)
- KEY_* (e.g. KEY_ENTER)
- MOUSE_BUTTON_* (e.g. MOUSE_BUTTON_LEFT)
- LOG_* (e.g. LOG_INFO)
General Interface
Window-related functions
[procedure] (init-window WIDTH HEIGHT TITLE)[procedure] (close-window)
[procedure] (get-screen-width)
[procedure] (get-screen-height)
[procedure] (window-should-close?)
Drawing-related functions
[procedure] (begin-drawing)[procedure] (end-drawing)
[procedure] (begin-mode-2d CAMERA)
[procedure] (end-mode-2d)
[procedure] (clear-background COLOR)
Timing-related functions
[procedure] (set-target-fps FPS)[procedure] (get-frame-time)
[procedure] (get-time)
[procedure] (get-fps)
Input-related functions: keyboard
[procedure] (key-pressed? KEY)[procedure] (key-pressed-repeat? KEY)
[procedure] (key-down? KEY)
[procedure] (key-released? KEY)
[procedure] (key-up? KEY)
[procedure] (get-key-pressed)
[procedure] (get-char-pressed)
Input-related functions: mouse
[procedure] (mouse-button-pressed? MOUSEBUTTON)[procedure] (mouse-button-down? MOUSEBUTTON)
[procedure] (mouse-button-released? MOUSEBUTTON)
[procedure] (mouse-button-up? MOUSEBUTTON)
[procedure] (get-mouse-x)
[procedure] (get-mouse-y)
[procedure] (get-mouse-position)
Misc. functions
[procedure] (trace-log LOGLEVEL TEXT)File system functions
[procedure] (change-directory DIR)Texture loading functions
[procedure] (load-texture FILENAME)Basic shapes drawing functions
[procedure] (draw-pixel POSX POSY COLOR)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