Skip to content

Instantly share code, notes, and snippets.

View oakes's full-sized avatar

Zach Oakes oakes

View GitHub Profile
@oakes
oakes / core.clj
Last active May 28, 2016 08:16
Minimal 3D
(defscreen main-screen
:on-show
(fn [screen entities]
(update! screen
:renderer (model-batch)
:attributes (let [attr-type (attribute-type :color :ambient-light)
attr (attribute :color attr-type 0.8 0.8 0.8 1)]
(environment :set attr))
:camera (doto (perspective 75 (game :width) (game :height))
(position! 0 0 3)
@oakes
oakes / core.clj
Created May 27, 2014 19:03
3D Physics
(print "Click the screen to create a new block.")
(def ^:const mass 10)
(defn get-environment
[]
(let [attr-type (attribute-type :color :ambient-light)
attr (attribute :color attr-type 0.3 0.3 0.3 1)]
(environment :set attr)))
@oakes
oakes / core.clj
Last active August 29, 2015 14:01
2D Physics
(def ^:const pixels-per-tile 32)
(defn create-ball-body!
[screen radius]
(let [body (add-body! screen (body-def :dynamic))]
(->> (circle-shape :set-radius radius)
(fixture-def :density 1 :friction 0 :restitution 1 :shape)
(body! body :create-fixture))
body))