diff options
| author | El-BG-1970 <elouangros@hotmail.com> | 2022-08-26 16:56:03 +0200 |
|---|---|---|
| committer | El-BG-1970 <elouangros@hotmail.com> | 2022-08-26 16:56:03 +0200 |
| commit | b729d2f97a9002cd9810b07d5a8178c3f6dd83e9 (patch) | |
| tree | 2cc4d0d2baa09140660036a004f017616df4b75e /src/main.lisp | |
| parent | 4198d1ae1d53b87ad0dfcc489b0e90b7f69c6b23 (diff) | |
| download | transacc-b729d2f97a9002cd9810b07d5a8178c3f6dd83e9.tar.gz | |
added prices panel to gui and panel switching
Diffstat (limited to 'src/main.lisp')
| -rw-r--r-- | src/main.lisp | 37 |
1 files changed, 29 insertions, 8 deletions
diff --git a/src/main.lisp b/src/main.lisp index 8baf355..12c1483 100644 --- a/src/main.lisp +++ b/src/main.lisp @@ -7,7 +7,9 @@ (clim:define-application-frame superapp () ((cur-zone :initarg :start-zone - :accessor cur-zone)) + :accessor cur-zone) + (cur-panel :initform '(stats) + :accessor cur-panel)) ;; :panes section describes different parts of the ;; application-frame. This application has only one pane. (:panes @@ -30,8 +32,8 @@ (default (clim:vertically () (1/8 title) (4/8 (clim:horizontally () - (2/3 zone-price) - (1/3 panel))) + (1/2 zone-price) + (1/2 panel))) (3/8 int))))) (defmethod frame-standard-output ((frame superapp)) @@ -68,14 +70,33 @@ :align-x :center :align-y :top)) (defmethod display-zone-price ((frame superapp) stream) - (format-zone-price (game:commodities-panel g) stream)) + (format stream "Prices for ~a~%" (zone:name (game:get-cur-zone g))) + (format-zone-price + (game:commodities-panel g (game:get-cur-zone g)) stream)) (defmethod display-panel ((frame superapp) stream) - (format-stats (game:player-stats g) stream)) + (case (car (cur-panel frame)) + ('stats (format-stats (game:player-stats g) stream)) + ('prices (progn + (format stream "Prices for ~a~%" (cdr (cur-panel frame))) + (format-zone-price + (game:commodities-panel g + (game:get-zone g + (cdr (cur-panel frame)))) + stream))))) ;; Panel command - (define-superapp-command (com-panel :name t) () - (format-zone-price (game:commodities-panel g) t)) - + (define-superapp-command (com-prices :name t) ((zone 'string)) + (clim:with-application-frame (frame) + (if (game:get-zone g zone) + (setf (cur-panel frame) (cons 'prices zone)) + (format (frame-standard-output frame) + "Zone ~A does not exist~%" + zone)))) + ;; Stats command + (define-superapp-command (com-stats :name t) () + (clim:with-application-frame (frame) + (setf (cur-panel frame) '(stats)))) + ;; Buy command (define-superapp-command (com-buy :name t) ((item 'string) (quantity 'integer)) |
