source: project/wiki/eggref/4/glfw @ 33385

Last change on this file since 33385 was 33385, checked in by evhan, 3 years ago

egg-locations: Migrate my eggs from bitbucket.org to foldling.org

File size: 1.4 KB
Line 
1== GLFW
2
3[[toc:]]
4
5[[http://www.glfw.org/|GLFW]] bindings for Chicken Scheme.
6
7The source for this extension is available
8[[http://git.foldling.org/chicken-glfw.git|here]].
9
10Note that this extension applies to Version 2 of the GLFW library. For
11an interface to GLFW Version 3, see the [[/egg/glfw3|glfw3]] egg.
12
13=== API
14
15Constant & function names & signatures match those of GLFW.
16
17=== Example
18
19<enscript highlight="scheme">
20(use gl glfw extras data-structures)
21
22(define *width* 640)
23(define *height* 480)
24(define *colors* '(.2 .4 .6 .8))
25
26(define-external (window_resize (integer width) (integer height)) void
27  (gl:Viewport 0 0 *width* *height*))
28
29(define-external (window_charpress (char c) (integer t)) void
30  (when (eq? c #\q)
31    (exit)))
32
33(glfwInit)
34(glfwOpenWindow *width* *height* 8 8 8 8 8 8 GLFW_WINDOW)
35(glfwSetWindowSizeCallback (location window_resize))
36(glfwSetCharCallback (location window_charpress))
37(glfwSetWindowTitle "Chicken Party!")
38
39(let COLORS!!! ()
40  (apply gl:ClearColor (shuffle *colors* random))
41  (gl:Clear gl:COLOR_BUFFER_BIT)
42  (glfwSwapBuffers)
43  (glfwWaitEvents)
44  (COLORS!!!))
45</enscript>
46
47=== See Also
48
49* [[/egg/glfw3|glfw3]]
50
51=== Author
52
53Evan Hanson
54
55The heavy lifting was done by Felix Winkelman's [[/egg/bind|bind egg]],
56I just fiddled with the header file and fixed up the output a bit. Bug
57reports should go to me, though.
58
59=== License
60
61Public Domain
Note: See TracBrowser for help on using the repository browser.