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

Last change on this file since 36801 was 36801, checked in by evhan, 11 months ago

wiki/eggref: update docs/formatting/urls and eggref/5/{r7rs,fancypants,chicken-belt}

File size: 1.4 KB
Line 
1== GLFW
2
3[[toc:]]
4
5[[https://www.glfw.org/|GLFW]] bindings for Chicken Scheme.
6
7The source for this extension is available
8[[https://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 [[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* [[glfw3]]
50
51== Author
52
53[[/users/evan-hanson|Evan Hanson]]
54
55The heavy lifting was done by Felix Winkelman's [[bind]] egg, I just
56fiddled with the header file and fixed up the output a bit. Bug reports
57should still go to me, though.
58
59== License
60
61Public Domain
Note: See TracBrowser for help on using the repository browser.