anchor.diff:  	      (let ((h (sdl2:haptic-open-from-joystick joy)))
   		(setf *haptic* (acons i h *haptic*))
   		(sdl2:rumble-init h))))))
  -
     (format t "Controlers found: ~A~%" *controllers*))
   
   (defun uninit-controllers ()
  -  (format t "Closing opened game controllers.~%")
  -  (finish-output)
  +  (force-print t "Closing opened game controllers.~%")
     ;; close any game controllers that were opened
     ;; as well as any haptics
     (loop for (i . controller) in *controllers*
  
positive.code:   (gl:depth-func :less)
    (gl:depth-range 0.0 1.0))
  
  
  (defun init-controllers ()
    (setf *controllers* nil
  	*haptic* nil)
  
    (format t "Opening game controllers. ~A ~%"
  	  (sdl2-ffi.functions::sdl-game-controller-add-mappings-from-rw
  	   (sdl2::sdl-rw-from-file
  	    (concatenate 'string
  			 (directory-namestring
  			  (asdf:system-relative-pathname :clinch "clinch.asd"))
  			 "SDL_GameControllerDB/gamecontrollerdb.txt")
  	    "rw") 1))
    (finish-output)
    ;; open any game controllers
  
    (loop for i from 0 upto (- (sdl2:joystick-count) 1)
       do (when (sdl2:game-controller-p i)
  	  (format t "Found gamecontroller: ~a~%"
  		  (sdl2:game-controller-name-for-index i))
  
  	  (let* ((gc (sdl2:game-controller-open i))
  		 (joy (sdl2:game-controller-get-joystick gc)))
  	    (setf *controllers* (acons i gc *controllers*))
  
negative.code: 		(double-buffer t)
  		(hidden nil)
  		(resizable t))
    (unless *running*
      (let ((local-stdout *standard-output*)
  	  (local-input *standard-input*))
        (with-main
          (let ((*standard-output* local-stdout)
                (*standard-input* local-input))
            (setf *running* t)
            (print-sdl-version)
            (unless *inited*
              (sdl2:with-everything (:window
                                     (win :w width :h height :title title
                                          :flags (remove nil
                                                         `(:shown
                                                           :opengl
                                                           ,(when fullscreen
                                                                  :fullscreen-desktop)
                                                           ,(when resizable
                                                                  :resizable)
                                                           ,(when no-frame
                                                                  :borderless)
                                                           ,(when hidden
                                                                  :hidden))))
                                     :gl gl-context)
                (when init-controllers (init-controllers))
                (when context-profile-mask (sdl2:gl-set-attr :context-profile-mask
                                                             context-profile-mask))
                (when alpha-size (sdl2:gl-set-attr :alpha-size alpha-size))
                (when depth-size (sdl2:gl-set-attr :depth-size depth-size))
                (when stencil-size (sdl2:gl-set-attr :stencil-size stencil-size))
                (when red-size (sdl2:gl-set-attr :red-size red-size))
                (when green-size (sdl2:gl-set-attr :green-size green-size))
                (when blue-size (sdl2:gl-set-attr :blue-size blue-size))
                (when buffer-size (sdl2:gl-set-attr :buffer-size buffer-size))
                (sdl2:gl-set-attr :doublebuffer (if double-buffer 1 0))
                (setf *uncollected*
                      #+(or ccl ecl) (make-hash-table :test 'eq)
                      #-(or ccl ecl) (trivial-garbage:make-weak-hash-table
                                      :weakness :key-or-value))
                (setf *dependents*
                      #+(or ccl ecl) (make-hash-table :test 'eq)
                      #-(or ccl ecl) (trivial-garbage:make-weak-hash-table
                                      :weakness :key-or-value))
                (setf *window* win
                      *context* gl-context)
                (ensure-cepl-compatible-setup)
                (set-default-gl-options)
                ;; basic window/gl setup
                (force-print t "Setting up window/gl.~%")
                (sdl2:gl-make-current win gl-context)
                (gl:viewport 0 0 width height)
                (gl:clear :color-buffer)
                (force-print t "Beginning main loop.~%")
                (setf *entity* nil
                      *texture* nil
                      *ticks* (sdl2:get-ticks)
                      *delta-ticks* *ticks*
                      *root* (make-instance 'node :translation (v! 0 0 -100)))
                (main-loop win gl-context width height asynchronous)
                (unload-all-uncollected)
                (setf *root* nil
                      *entity* nil
                      *texture* nil
                      *running* nil
                      *inited* nil
                      *generic-single-texture-shader* nil
                      *generic-solid-phong-shader* nil
                      *generic-single-diffuse-light-animation-shader* nil
                      *generic-single-diffuse-light-shader* nil
                      *generic-single-diffuse-light-per-vertex-color* nil
                      *default-texture* nil))))))))
  
  (defun uninit ()
    (with-main
        (setf *running* nil
  	    *inited* nil)
        (uninit-controllers)
      (sdl2:push-event :quit)))
  