diff options
Diffstat (limited to 'src/main.lisp')
| -rw-r--r-- | src/main.lisp | 35 |
1 files changed, 29 insertions, 6 deletions
diff --git a/src/main.lisp b/src/main.lisp index 1fd05a9..b3c6933 100644 --- a/src/main.lisp +++ b/src/main.lisp @@ -6,16 +6,22 @@ (in-package :transacc) (clim:define-application-frame superapp () - () + ((cur-zone :initarg :start-zone + :accessor cur-zone)) ;; :panes section describes different parts of the ;; application-frame. This application has only one pane. (:panes - (int :interactor :height 400 :width 600)) + (title :title-pane + :display-time :command-loop + :display-function 'display-title) + (int :interactor)) ;; :layouts section describes how the panes are layed out. ;; This application has one layout named "default" which has a single pane. (:layouts - (default int))) + (default (clim:vertically () + (1/8 title) + (7/8 int))))) (defun format-panel (panel) (loop for it in panel do @@ -35,6 +41,13 @@ (z2 (zone:new-zone "Manhattan" c2)) (g (game:new-game p z2 (list z z2)))) + (defmethod display-title ((frame superapp) stream) + (clim:draw-text* stream + (format nil "Joze~%~a" (zone:name (game:get-cur-zone g))) + 300 2 + :align-x :center + :align-y :top)) + ;; Panel command (define-superapp-command (com-panel :name t) () (format-panel (game:commodities-panel g))) @@ -49,6 +62,16 @@ ;; Goto command (define-superapp-command (com-goto :name t) ((dest 'string)) - (game:change-zone g dest)) - - (clim:run-frame-top-level (clim:make-application-frame 'superapp)))) + (clim:with-application-frame (frame) + (if (game:change-zone g dest) + (progn + (setf (cur-zone frame) (zone:name (game:get-cur-zone g))) + (format t "~a~%" (cur-zone frame)) + (format t "Arrived in ~a" (zone:name (game:get-cur-zone g)))) + (format t "Zone ~a does not exist!" dest)))) + + (clim:run-frame-top-level + (clim:make-application-frame 'superapp + :height 400 + :width 600 + :start-zone (game:get-cur-zone g))))) |
