Skip to content

Commit 9e60baa

Browse files
jamielyclaude
andcommitted
Update dark theme and fix canvas layout positioning
- Change body background to dark blue-gray (#2c3e50) with light text - Reduce canvas width from 9 blocks to 6 blocks to match game grid - Add rendering offset to eliminate left margin and prevent right column cutoff - Adjust coordinate positioning for blocks, cursor, and garbage block rendering 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 01394df commit 9e60baa

2 files changed

Lines changed: 17 additions & 10 deletions

File tree

resources/public/css/styles.css

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66

77
body {
88
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
9-
background-color: #f5f5f5;
10-
color: #333;
9+
background-color: #2c3e50;
10+
color: #ecf0f1;
1111
line-height: 1.6;
1212
}
1313

@@ -70,7 +70,7 @@ a:hover {
7070
}
7171

7272
#canvas {
73-
background: #f5f5f5;
73+
background: #2c3e50;
7474
max-width: 100vw;
7575
max-height: 100vh;
7676
}

src/cljs/attack/display.cljs

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
(def BASE-BLOCKWIDTH 30)
1616
(def BASE-BLOCKHEIGHT 30)
1717
(def BASE-DISPLAYHEIGHT 400)
18-
(def BASE-DISPLAYWIDTH (* 9 BASE-BLOCKWIDTH))
18+
(def BASE-DISPLAYWIDTH (* 6 BASE-BLOCKWIDTH))
1919
(def BASE-ASPECT-RATIO (/ BASE-DISPLAYWIDTH BASE-DISPLAYHEIGHT))
2020

2121
;; Scaling state
@@ -80,14 +80,18 @@
8080
(reset! resize-handler-setup true)))
8181

8282
(defn draw-block-fun [total-rows fun {pt :position color :type}]
83-
(let [[x y] (dispm/pt-to-display-pt (disp-info total-rows) pt)]
84-
(fun (draw-context) (name color) x y (BLOCKWIDTH) (BLOCKHEIGHT))))
83+
(let [[x y] (dispm/pt-to-display-pt (disp-info total-rows) pt)
84+
;; Adjust x to account for 1-based grid coordinates
85+
adj-x (- x (BLOCKWIDTH))]
86+
(fun (draw-context) (name color) adj-x y (BLOCKWIDTH) (BLOCKHEIGHT))))
8587

8688
(defn render-cursor [total-rows {pt :origin :as cursor}]
8789
(let [context (draw-context)
8890
nofill-block (fn [pt]
89-
(let [[x y] (dispm/pt-to-display-pt (disp-info total-rows) pt)]
90-
(orect context "black" x y (BLOCKWIDTH) (BLOCKHEIGHT))))]
91+
(let [[x y] (dispm/pt-to-display-pt (disp-info total-rows) pt)
92+
;; Adjust x to account for 1-based grid coordinates
93+
adj-x (- x (BLOCKWIDTH))]
94+
(orect context "black" adj-x y (BLOCKWIDTH) (BLOCKHEIGHT))))]
9195
(nofill-block pt)
9296
(nofill-block (pt/point-add pt (pt/point 1 0)))))
9397

@@ -220,13 +224,16 @@
220224
apos (pt/point (+ ox length) (+ oy height))
221225
[ox' oy'] (dispm/pt-to-display-pt (disp-info total-rows) [ox oy])
222226
[ax' ay'] (dispm/pt-to-display-pt (disp-info total-rows) apos)
223-
width (- ax' ox')
227+
;; Adjust x coordinates to account for 1-based grid coordinates
228+
adj-ox' (- ox' (BLOCKWIDTH))
229+
adj-ax' (- ax' (BLOCKWIDTH))
230+
width (- adj-ax' adj-ox')
224231
height (- oy' ay')
225232
context (draw-context)]
226233
(draw-garbage-block-with-color total-rows inner :AAA)
227234
(doall (map #(draw-block total-rows (brighten-block % 0.9))
228235
pending))
229-
(orect context "black" ox' oy' width height)))
236+
(orect context "black" adj-ox' oy' width height)))
230237

231238
(defn draw-garbage-block [total-rows block]
232239
(draw-garbage-block-with-color total-rows block :black))

0 commit comments

Comments
 (0)