diff options
author | Logan Hunt <loganhunt@simponic.xyz> | 2022-05-31 23:23:58 -0700 |
---|---|---|
committer | Logan Hunt <loganhunt@simponic.xyz> | 2022-05-31 23:23:58 -0700 |
commit | a76bfbf944d8ac89b7581ed378f4782084aa404a (patch) | |
tree | 8bc2267a73c9e2c0c7d35cca304dcf406b376851 /ui.lisp | |
parent | 10d7a20a79f8e7746d965cfadf1757b3e3799858 (diff) | |
download | lispruns-a76bfbf944d8ac89b7581ed378f4782084aa404a.tar.gz lispruns-a76bfbf944d8ac89b7581ed378f4782084aa404a.zip |
User can create new category on the CLI
Diffstat (limited to 'ui.lisp')
-rw-r--r-- | ui.lisp | 24 |
1 files changed, 13 insertions, 11 deletions
@@ -18,6 +18,12 @@ (inc yi)) slices))) +;; Formats a category split and a run split for the splits window +(defun make-split-line (csplit speedrun-split) + `((,(category-split-name csplit) . ,(/ 4 12)) + ("" . ,(/ 1 12)) + (,(run-split-format-elapsed-time speedrun-split) . ,(/ 3 12)))) + ;; Creates a window with the total time and statistics (defun timer-window (speedrun pos width height) (let* ((timerglet (lispglet (format-time (make-time-alist (speedrun-elapsed speedrun))))) @@ -82,6 +88,7 @@ (subseq elements (car elements-to-draw-subseq) (cadr elements-to-draw-subseq)))) highlight-menu)) +;; The big bad monolithic UI loop (defun speedrun-ui (category) (croatoan:with-screen (scr :input-blocking nil :input-echoing nil :cursor-visible nil :enable-colors t :input-buffering nil :input-blocking nil) (setf (croatoan:background scr) (make-instance 'croatoan:complex-char :color-pair (cdr (assoc 'main *colors*)))) @@ -90,7 +97,9 @@ (state 'TITLE) (redraws '(title-instance)) (speedrun (make-speedrun category)) - (csplits (category-splits category))) + (csplits (category-splits category)) + ;; TODO + (pbs ())) (flet ((render () (case state ('TITLE @@ -124,16 +133,8 @@ :current-element-index (speedrun-current-split-index speedrun) :height splits-height :width max-width - :elements (mapcar (lambda (csplit speedrun-split) - `( - (,(category-split-name csplit) . ,(/ 4 12)) - ("" . ,(/ 1 12)) - (,(format-elapsed-time speedrun-split) . ,(/ 3 12)) - )) - csplits - (speedrun-splits speedrun)))) -;; :elements (mapcar #'category-split-name csplits))) -;; :elements `((("FIRST SPLIT IS EPIC" . ,(/ 4 12)) ("" . ,(/ 1 12)) ("10:10:00.22" . ,(/ 3 12)) ("" . ,(/ 1 12)) ("20:00.00" . ,(/ 3 12)))))) + ;; Todo: add personal bests to elements + :elements (mapcar 'make-split-line csplits (speedrun-splits speedrun)))) (splits-instance (highlight-list-window split-list `(0 ,centered-x))) (timer-instance (timer-window speedrun `(,splits-height ,centered-x) max-width timer-height))) (croatoan:refresh splits-instance) @@ -143,6 +144,7 @@ (if (zerop (mod frame 30)) (inc scroll)) (sleep (/ 1 60)))) + (croatoan:event-case (scr event) (#\q (return-from croatoan:event-case)) (#\space |