diff --git a/resources/public/index.html b/resources/public/index.html index 9e2badb..1949762 100644 --- a/resources/public/index.html +++ b/resources/public/index.html @@ -12,7 +12,7 @@
FPS:
Position:
Velocity:
- + diff --git a/src/cljs/frpong/core.cljs b/src/cljs/frpong/core.cljs index c69aede..009387e 100644 --- a/src/cljs/frpong/core.cljs +++ b/src/cljs/frpong/core.cljs @@ -50,7 +50,8 @@ pos-next [(+ x (* vel-x tick)) (+ y (* vel-y tick))]] (>! pos-chan-out pos-next)))) -(defn collision-detector [{:keys [width height padding]} tick-chan pos-chan vel-chan-in vel-chan-out] +(defn collision-detector + [{:keys [width height padding]} tick-chan pos-chan vel-chan-in vel-chan-out] (go-loop (let [adjust-v (fn [p v size] (cond @@ -74,14 +75,15 @@ :up (>! pos-chan-out (max (- pos movement) 0)) :down (>! pos-chan-out (min (+ pos movement) max-y))))))) -(defn render-loop [[pos-chan vel-chan pl-pos-chan pr-pos-chan]] +(defn renderer [pos-chan vel-chan pl-pos-chan pr-pos-chan] (go-loop (let [[x y] (map int (