Skip to content

Commit

Permalink
fix mystic f**king s**t
Browse files Browse the repository at this point in the history
  • Loading branch information
ttim committed Sep 27, 2014
1 parent 6799f97 commit 67a91b0
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 10 deletions.
17 changes: 11 additions & 6 deletions src/rockets/game.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,22 @@
[rockets.model :as model]))

(q/defcomponent
CellComponent [cell selected?]
(sprites/CoolSpriteComponent (:cell-type cell) (:orientation cell) selected? false))
;CellComponent [cell selected?]
CellComponent [args]
(let [cell-type ((args :cell) :cell-type)
orientation ((args :cell) :orientation)
selected? (args :selected?)]
(sprites/CoolSpriteComponent {:type cell-type, :angle orientation, :selected? selected?, :fire? false})))

(q/defcomponent
FieldComponent [cells selected]
;FieldComponent [cells selected]
FieldComponent [args]
(html [:table {:style util/no-borders-style}
(for [x (range 0 model/size-n)]
[:tr {:style util/no-borders-style}
(for [y (range 0 model/size-m)
:let [cell (nth (nth cells x) y)]]
[:td {:style util/no-borders-style} (CellComponent cell false)])])]))
:let [cell (nth (nth (args :cells) x) y)]]
[:td {:style util/no-borders-style} (CellComponent {:cell cell, :selected? false})])])]))

(q/defcomponent
ShuffleComponent [refresh-time]
Expand All @@ -29,7 +34,7 @@
(html [:table {:style util/no-borders-style}
[:tr {:style util/no-borders-style}
[:td {:style (merge {:vertical-align "bottom"} util/no-borders-style)} (ShuffleComponent (:reload-time board))]
[:td {:style util/no-borders-style} (FieldComponent (:cells board) (:selected board))]]]))
[:td {:style util/no-borders-style} (FieldComponent board)]]]))

(def space-between-boards (* sprites/sprite-width 4))
(def board-width (* sprites/sprite-width (inc model/size-m)))
Expand Down
4 changes: 2 additions & 2 deletions src/rockets/model.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -110,9 +110,9 @@
(util/update-value board [:cells ((board :selected) :x) ((board :selected) :y)] do-rotate-cell))

(defn event-select [game-state board]
;(js/console.log (sablono.util/to-str ((:cells (game-state board)) 0)))
;todo add action when selected in reset field
(util/update-value game-state [board] do-rotate-selected))

(defn event-tick [game-state tick]
(when (= (mod tick 100) 0) (js/console.log tick))
game-state)
(if (= (mod tick 10) 0) (event-select game-state :board1) game-state))
5 changes: 3 additions & 2 deletions src/rockets/sprites.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -52,5 +52,6 @@
(html [:div {:style fire-style}]))

(q/defcomponent
CoolSpriteComponent [type angle selected? fire?]
(html (selected-state (fire-state(sprite type angle) fire?) selected?)))
;CoolSpriteComponent [type, angle, fire?, selected?]
CoolSpriteComponent [args]
(html (selected-state (fire-state(sprite (args :type) (args :angle)) (args :fire?)) (args :selected?))))

2 comments on commit 67a91b0

@mbme
Copy link

@mbme mbme commented on 67a91b0 Oct 1, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ttim
Copy link
Contributor Author

@ttim ttim commented on 67a91b0 Oct 2, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, thanks! Now not mystic at all =)

Please sign in to comment.