X-Git-Url: https://code.consxy.com/gitweb/gitweb.cgi?a=blobdiff_plain;f=src%2Fmain%2Finterface.lisp;h=dd6c4ce9be01face6ef10a9cf2f38680d1b5259c;hb=81d51af6e0ac022d1e96b2bcd45909b75d855675;hp=92f292ab4a00b3859bbc6207f4b0a94e4611e0a2;hpb=5c8699f151207953f4029e0fc6c488afce99f756;p=clnl diff --git a/src/main/interface.lisp b/src/main/interface.lisp index 92f292a..dd6c4ce 100644 --- a/src/main/interface.lisp +++ b/src/main/interface.lisp @@ -1,12 +1,12 @@ (in-package #:clnl-interface) (defvar *patch-size* 13d0) -(defvar *world-dims* '(:xmin -5 :xmax 5 :ymin -5 :ymax 5)) (defvar *turtle-list* nil) ; It may be useful to keep windows around (defvar *glut-window-opened* nil) +(defvar *dimensions* nil) (defvar *colors* '((140 140 140) ; gray (5) @@ -60,7 +60,7 @@ (cl-glut:post-redisplay)) (defun close-func () - (sb-ext:exit)) + (sb-ext:exit :abort t)) (defun reshape (width height) (when (and (/= 0 width) (/= 0 height)) @@ -84,6 +84,27 @@ (gl:vertex 260 250 0) (gl:end))) +(defun initialize (&key dims) + "INITIALIZE &key DIMS => RESULT + + DIMS: (:xmin XMIN :xmax XMAX :ymin YMIN :ymax YMAX) + +ARGUMENTS AND VALUES: + + RESULT: undefined + XMIN: An integer representing the minimum patch coord in X + XMAX: An integer representing the maximum patch coord in X + YMIN: An integer representing the minimum patch coord in Y + YMAX: An integer representing the maximum patch coord in Y + +DESCRIPTION: + + This is where the initialization of the interface that sits behind + the interface lives. From here, one can go into headless or running + mode, but for certain things this interface will still need to act, + and also allows for bringing up and taking down of visual elements." + (setf *dimensions* dims)) + (defun run () "RUN => RESULT @@ -102,13 +123,13 @@ DESCRIPTION: ; want to investigate until simply ignoring them becomes a problem. (sb-int:with-float-traps-masked (:invalid) (cl-glut:init) - (gl:clear-color 0 0 0 1) (cl-glut:init-window-size - (floor (* *patch-size* (1+ (- (getf *world-dims* :xmax) (getf *world-dims* :xmin))))) - (floor (* *patch-size* (1+ (- (getf *world-dims* :ymax) (getf *world-dims* :ymin)))))) - (setf *glut-window-opened* t) - (cl-glut:create-window "CLNL Test Window") + (floor (* *patch-size* (1+ (- (getf *dimensions* :xmax) (getf *dimensions* :xmin))))) + (floor (* *patch-size* (1+ (- (getf *dimensions* :ymax) (getf *dimensions* :ymin)))))) (cl-glut:init-display-mode :double :rgba) + (cl-glut:create-window "CLNL Test Window") + (setf *glut-window-opened* t) + (gl:clear-color 0 0 0 1) (cl-glut:display-func (cffi:get-callback 'display)) (glut:reshape-func (cffi:callback reshape)) (cl-glut:idle-func (cffi:get-callback 'idle)) @@ -136,16 +157,23 @@ DESCRIPTION: (sb-int:with-float-traps-masked (:invalid) (when (not *glut-window-opened*) (cl-glut:init) - (gl:clear-color 0 0 0 1) (cl-glut:init-window-size 1 1) (cl-glut:create-window "CLNL Test Window") + (gl:clear-color 0 0 0 1) (set-turtle-list) (setf *glut-window-opened* t)) (let ((fbo (first (gl:gen-framebuffers 1))) (render-buf (first (gl:gen-renderbuffers 1))) - ;(width (floor (* *patch-size* (1+ (- (getf *world-dims* :xmax) (getf *world-dims* :xmin)))))) - ;(height (floor (* *patch-size* (1+ (- (getf *world-dims* :ymax) (getf *world-dims* :ymin)))))) + ;(width + ; (floor (* *patch-size* (1+ (- + ; (getf *dimensions* :ymax) + ; (getf *dimensions* :ymin)))))) + ;(height + ; (floor (* *patch-size* (1+ (- (getf *world-dims* :xmax) (getf *world-dims* :xmin)))))) + ; (floor (* *patch-size* (1+ (- + ; (getf *dimensions* :xmax) + ; (getf *dimensions* :xmin))))) (width 143) ; Hard coded for now, yay v1 (if you see this comment in a year, please cry for me) (height 143)) (gl:bind-framebuffer :framebuffer fbo)