From 5e764e9edd3c5e33fa9a384b49b74e5c4eb370a3 Mon Sep 17 00:00:00 2001 From: gonzo Date: Fri, 25 Oct 2024 19:20:18 +0200 Subject: first commit --- raylib.sld | 79 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 79 insertions(+) create mode 100644 raylib.sld (limited to 'raylib.sld') diff --git a/raylib.sld b/raylib.sld new file mode 100644 index 0000000..4b9ab17 --- /dev/null +++ b/raylib.sld @@ -0,0 +1,79 @@ +(define-library (raylib) + (export init-window close-window) + (export with-drawing begin-drawing end-drawing) + (export in-scissor-mode begin-scissor-mode end-scissor-mode) + (import (gambit)) + + ;;; ------- + ;;; structs + ;;; ------- + (include "structs.scm") + ;;; ------------------------- + ;;; Drawing-related functions + ;;; ------------------------- + (include "drawing.scm") + ;;; ------------------------ + ;;; Timing-related functions + ;;; ------------------------ + (include "timing.scm") + ;;; ----------------------------------------- + ;;; Input-related functions: keyboard & mouse + ;;; ----------------------------------------- + (include "input.scm") + ;;; -------------- + ;;; rshapes module + ;;; -------------- + (include "shapes.scm") + + (begin + (c-declare "#include \"raylib.h\"") + + ;;; ------------------------ + ;;; Window-related functions + ;;; ------------------------ + ;; Initialize window and OpenGL context + ;; void InitWindow(int width, int height, const char *title); + (define init-window + (c-lambda (int int char-string) void + "InitWindow")) + + ;; Close window and unload OpenGL context + ;; void CloseWindow(void); + (define close-window + (c-lambda () void "CloseWindow")) + + (define window-sould-close + (c-lambda () bool "WindowShouldClose")) + + + (define draw-fps + (c-lambda (int int) void "DrawFPS")) + + + ;;; MACROS + + ;;; hygienic drawing context (r7rs only!) + (define-syntax with-drawing + (syntax-rules () + ((with-drawing body ...) + (dynamic-wind + begin-drawing + (lambda () (begin body ...)) + end-drawing)))) + + ;;; less hygienic drawing context for R5RS + ;; (define-macro (with-drawing . body) + ;; `(dynamic-wind + ;; begin-drawing + ;; (lambda () (begin ,@body)) + ;; end-drawing)) + + ;;; hygienic scissor-mode (r7rs only!) + (define-syntax in-scissor-mode + (syntax-rules () + ((in-scissor-mode (x y width height) body ...) + (dynamic-wind + (lambda () (begin-scissor-mode x y width height)) + (lambda () (begin body ...)) + end-scissor-mode)))) + )) -- cgit v1.2.3