blob: 44e78db2bad57eab8758b2fa4b65750f0119044a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
|
(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))
(pkg-config "gl" "raylib")
;;; -------
;;; 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))))
))
|