aboutsummaryrefslogtreecommitdiffstats
path: root/raylib.sld
diff options
context:
space:
mode:
Diffstat (limited to 'raylib.sld')
-rw-r--r--raylib.sld79
1 files changed, 79 insertions, 0 deletions
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))))
+ ))