1 (in-package :lambdamundo
)
3 ;; called when window is resized
4 (cffi:defcallback lambdamundo-resize-callback
5 :void
((width :int
) (height :int
))
6 (let* ((ar (/ height width
)))
7 (gl:viewport
0 0 width height
)
8 (gl:with-setup-projection
9 (glu:perspective
45.0 ar
0.1 50.0))))
12 (defmacro lambdamundo-window
((title &key
14 (colourbits '(:redbits
0 :greenbits
0 :bluebits
0 :alphabits
0))
19 "Top level form for managing our window."
20 (destructuring-bind (width height
)
22 (destructuring-bind (redbits greenbits bluebits alphabits
)
24 (destructuring-bind (&key pre start main end
33 (glfw:with-init-window
(,title
,width
,height
,redbits
,greenbits
,bluebits
,alphabits
,depthbits
,stencilbits
,mode
)
36 `(glfw:set-mouse-button-callback
(cffi:callback
,mouse-callback
)))
38 `(glfw:set-key-callback
(cffi:callback
,key-callback
)))
39 ,(when resize-callback
40 `(glfw:set-window-size-callback
(cffi:callback
,resize-callback
)))
42 `(glfw:set-char-callback
(cffi:callback
,char-callback
)))
46 (while (eql (glfw:get-window-param glfw
:+opened
+) gl
:+true
+)))