Small logic changes
This commit is contained in:
parent
8627f06ebd
commit
89fa09c387
1 changed files with 23 additions and 24 deletions
27
game.scm
27
game.scm
|
@ -760,7 +760,7 @@
|
|||
(y (- (vec2-y center) (* tile-height (floor (/ height 2))))))
|
||||
;; Draw menu background
|
||||
(when (= r r-start)
|
||||
(let* ((x (- (vec2-x center) (* tile-width (floor (/ width 2)))))
|
||||
(let ((x (- (vec2-x center) (* tile-width (floor (/ width 2)))))
|
||||
(w (* tile-width width))
|
||||
(h (* tile-height height)))
|
||||
(set-fill-color! context "#000")
|
||||
|
@ -768,28 +768,27 @@
|
|||
(set-stroke-color! context "blue")
|
||||
(stroke-rect context x y w h)))
|
||||
;; Draw menu text
|
||||
(let ((r-menu-index (- (+ r (* (current-menu-page) menu:max-items)) (current-menu-page))))
|
||||
(set-font! context "normal 16px monogram")
|
||||
(set-fill-color! context "#fff")
|
||||
(when (= r r-start)
|
||||
(set-text-align! context "center")
|
||||
(fill-text context (menu-name (current-menu)) (vec2-x center) (+ y text-offset-y)))
|
||||
(let* ((r-index (- (+ r (* (current-menu-page) menu:max-items)) (current-menu-page))))
|
||||
(set-text-align! context "left")
|
||||
(if (= r-index (current-menu-index))
|
||||
(when (= r-menu-index (current-menu-index))
|
||||
(fill-text context "▸" gutter-x (+ y text-offset-y)))
|
||||
(if (and (>= r -1) (< r-index num-items) (< r r-end))
|
||||
(when (>= r -1)
|
||||
(fill-text context
|
||||
(if (= r -1)
|
||||
(if (= (current-menu-page) 0) "Back" "...")
|
||||
(if (and (= r (1- r-end)) (< r-index (1- num-items)))
|
||||
"..."
|
||||
(menu-item-name (vector-ref (menu-items (current-menu))
|
||||
r-index))))
|
||||
text-x (+ y text-offset-y))))
|
||||
(cond
|
||||
((= r-menu-index -1) "Back")
|
||||
((or (= r -1) (and (= r (1- r-end)) (< r-menu-index (1- num-items))))
|
||||
"...")
|
||||
(else
|
||||
(menu-item-name (vector-ref (menu-items (current-menu)) r-menu-index))))
|
||||
text-x (+ y text-offset-y)))
|
||||
;; Draw next row
|
||||
(set! r (1+ r))
|
||||
(if (< r (+ r-start height))
|
||||
(row r (+ y tile-height))))))
|
||||
(when (and (< (1+ r) r-end) (< (1+ r-menu-index) num-items))
|
||||
(row (1+ r) (+ y tile-height)))))))
|
||||
|
||||
(define (draw-level)
|
||||
(draw-background)
|
||||
|
|
Loading…
Add table
Reference in a new issue