play-cljc.gl.examples-2d

(image-example game {:keys [data width height], :as image})

Example

(play-cljc.gl.core/render game (-> entity (assoc :viewport {:x 0, :y 0, :width game-width, :height game-height}) (play-cljc.transforms/project game-width game-height) (play-cljc.transforms/translate 0 0) (play-cljc.transforms/scale img-width img-height)))

(rand-rects-example game entity entities)

Example

(for [_ (range 50)] (-> entity (play-cljc.transforms/color [(rand) (rand) (rand) 1]) (play-cljc.transforms/translate (rand-int game-width) (rand-int game-height)) (play-cljc.transforms/scale (rand-int 300) (rand-int 300))))

(rotation-example game)

Example

(play-cljc.gl.core/render game (-> entity (assoc :viewport {:x 0, :y 0, :width game-width, :height game-height}) (play-cljc.transforms/project game-width game-height) (play-cljc.transforms/translate tx ty) (play-cljc.transforms/rotate r) (play-cljc.transforms/color [1 0 0.5 1]) (play-cljc.transforms/translate -50 -75)))

(rotation-multi-example game)

Example

(loop [i 0 entity (-> entity (assoc :viewport {:x 0, :y 0, :width game-width, :height game-height}) (play-cljc.transforms/project game-width game-height) (play-cljc.transforms/color [1 0 0.5 1]))] (when (< i 5) (let [entity (-> entity (play-cljc.transforms/translate tx ty) (play-cljc.transforms/rotate r))] (play-cljc.gl.core/render game entity) (recur (inc i) entity))))

(scale-example game)

Example

(play-cljc.gl.core/render game (-> (assoc entity :viewport {:x 0, :y 0, :width game-width, :height game-height}) (play-cljc.transforms/project game-width game-height) (play-cljc.transforms/translate tx ty) (play-cljc.transforms/rotate 0) (play-cljc.transforms/scale rx ry) (play-cljc.transforms/color [1 0 0.5 1])))

(translation-example game)

Example

(play-cljc.gl.core/render game (-> (assoc entity :viewport {:x 0, :y 0, :width game-width, :height game-height}) (play-cljc.transforms/project game-width game-height) (play-cljc.transforms/translate x y) (play-cljc.transforms/color [1 0 0.5 1])))