draw-sketch!

Example

Extending this multimethod allows you to create new entity types. In this example, we create a new entity type called :smiley that draws a smiley face. After defining the method, it can be rendered like this: [:smiley {:x 0 :y 0}]
(defmethod play-cljs.core/draw-sketch! :smiley [game renderer content parent-opts] (let [[_ opts & children] content opts (play-cljs.options/update-opts opts parent-opts play-cljs.options/basic-defaults)] (play-cljs.core/draw-sketch! game renderer [:div {:x 100, :y 100} [:fill {:color "yellow"} [:ellipse {:width 100, :height 100} [:fill {:color "black"} [:ellipse {:x -20, :y -10, :width 10, :height 10}] [:ellipse {:x 20, :y -10, :width 10, :height 10}]] [:fill {} [:arc {:width 60, :height 60, :start 0, :stop 3.14}]]]]] opts) (play-cljs.core/draw-sketch! game renderer children opts)))