anchor.diff:      (5 :wheel-down)
       (otherwise button)))
   
  -
  -;;; GUI
  +(defstruct gui
  +  (default-font nil)
  +  (view (create-2d-view 0 0 *display-width* *display-height*))
  +  (widgets '())) ;; last one has focus
  +
  +(defun create-gui (default-font)
  +  (let ((gui (make-gui :default-font default-font)))
  +    (format t "Gui default font: ~S~%" default-font)
  +    (add-input-handler gui)
  +    gui))
  +
  +(defun destroy-gui (gui)
  +  (remove-input-handler gui)
  +  (setf gui nil))
  +
  +;; The following are helpers when you only need one gui in your app (i.e. a singleton)
   (defvar *gui* nil)
  -(defvar *gui-view* nil)
  -
  -(defstruct gui
  -  (font nil)
  -  (widgets '())) ;; last one has focus
   
   (defun init-gui (font)
  -  (setf *gui* (make-gui :font font))
  -  (setf *gui-view* (create-2d-view 0 0 *display-width* *display-height*))
  -  (add-input-handler *gui*))
  +  "Init GUI singleton using the provided bitmap font."
  +  (setf *gui* (create-gui font))
  +  (format t "Created gui: ~S~%" *gui*))
   
   (defun shutdown-gui ()
  -  (remove-input-handler *gui*)
  -  (destroy-font (gui-font *gui*))
  -  (setf *gui* nil))
  -
  -(defun render-gui ()
  -  (set-view-2d *gui-view*)
  -  (dolist (w (reverse (gui-widgets *gui*)))
  +  "Shutdown GUI singleton."
  +  (destroy-gui *gui*))
  +
  +(defun render-gui (&optional (gui *gui*))
  +  (set-view-2d (gui-view gui))
  +  (dolist (w (reverse (gui-widgets gui)))
       (render-widget w)
       (when (focused w)
         (gl:disable :texture-2d)
  
positive.code:   (coerce (reverse (input it)) 'string))
  
  (defmethod initialize-instance :after ((w gui-text-input) &key)
    (setf (height w) (string-height (text w) (gui-font *gui*)))
    (setf (width w) (string-width (text w) (gui-font *gui*))))
  
  ;; setup keymap
  ;; (key-handler (it gui-text-input) (:return :press)
  
negative.code:    (y-off :accessor gui-widget-y-off :initform 0 :initarg :y-off)
     ;; children layout (:vertical, :horizontal or :absolute)
     (layout :accessor gui-widget-layout :initform :absolute :initarg :layout)
     ;; visual appearance
     (color :accessor gui-widget-color
            :initform (create-color 0.35 0.35 0.35 0.5)
            :initarg :color)
     (texture :accessor gui-widget-texture :initform nil :initarg :texture)
     (visible :accessor visible :initform t)
     (font :accessor gui-widget-font :initform nil :initarg :font) ;; XXX: move this?
     (focused :accessor focused :initform t)
     (parent :accessor parent-widget :initform nil)
     (children :accessor children :initform '()))
  