Skip to content

Commit a6c9748

Browse files
committed
Filtering traces before rendering.
1 parent 6997940 commit a6c9748

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

src/hyperspace/ui.clj

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,10 +133,15 @@
133133
display-y (:y display-point)]
134134
(draw-ellipse display-x display-y (normalize-x 5) (normalize-y 5) 30)))
135135

136+
(defn space-point-on-display?
137+
[{x :x, y :y}]
138+
(and (< 0 x window-width)
139+
(< 0 y window-height)))
140+
136141
(defn draw-traces
137142
[bullet]
138143
(GL11/glColor3f 1 1 0)
139-
(doseq [point (:traces bullet)]
144+
(doseq [point (filter space-point-on-display? (:traces bullet))]
140145
(let [center (space-point-to-display point)
141146
{center-x :x center-y :y} center
142147
x1 (- center-x (normalize-x 1))

0 commit comments

Comments
 (0)