fix: demo uses backend-size instead of hardcoded 80x24
This commit is contained in:
18
demo.lisp
18
demo.lisp
@@ -125,8 +125,12 @@
|
||||
./demo.sh shell wrapper."
|
||||
(init-app-state)
|
||||
(let* ((backend (detect-backend))
|
||||
(w 80) (h 24))
|
||||
(declare (ignore h))
|
||||
(w (multiple-value-bind (cols rows) (backend-size backend)
|
||||
(declare (ignore rows))
|
||||
cols))
|
||||
(h (multiple-value-bind (cols rows) (backend-size backend)
|
||||
(declare (ignore cols))
|
||||
rows)))
|
||||
(initialize-backend backend)
|
||||
(unwind-protect
|
||||
(loop while (getf *app* :running)
|
||||
@@ -146,19 +150,19 @@
|
||||
(draw-text backend x-pos 4 label :text-muted nil))))
|
||||
;; Content area
|
||||
(case (getf *app* :tab)
|
||||
(0 (render-tab-home backend 4 6 72 20))
|
||||
(1 (render-tab-widgets backend 4 6 72 24
|
||||
(0 (render-tab-home backend 4 6 (- w 4) (- h 8)))
|
||||
(1 (render-tab-widgets backend 4 6 (- w 4) (- h 8)
|
||||
(getf *app* :input)
|
||||
(getf *app* :textarea)))
|
||||
(2 (render-tab-console backend 4 6 72 16)))
|
||||
(2 (render-tab-console backend 4 6 (- w 4) (- h 8))))
|
||||
;; Mouse cursor indicator
|
||||
(let ((mx (getf *app* :mouse-x))
|
||||
(my (getf *app* :mouse-y)))
|
||||
(when (and (>= mx 0) (>= my 0))
|
||||
(draw-text backend mx my "@" :bright-cyan nil)))
|
||||
;; Status bar
|
||||
(draw-rect backend 2 23 (- w 4) 1 :bg :blue)
|
||||
(draw-text backend 4 23
|
||||
(draw-rect backend 2 (- h 2) (- w 4) 1 :bg :blue)
|
||||
(draw-text backend 4 (- h 2)
|
||||
(format nil " Tab ~d/3 | ~d events "
|
||||
(1+ (getf *app* :tab)) (length *log*))
|
||||
:bright-white :blue :bold t)
|
||||
|
||||
Reference in New Issue
Block a user