first step in large refactoring to extract rooms.
This commit is contained in:
@@ -32,3 +32,23 @@
|
||||
tx (.getTexture tr)]
|
||||
(texture! tx :set-filter Texture$TextureFilter/Linear Texture$TextureFilter/Linear)
|
||||
font))
|
||||
|
||||
(def +screen-width+ 320)
|
||||
(def +screen-height+ 240)
|
||||
|
||||
(defn scaler-fn-with-baseline [baseline minimum-size & [maximum-size]]
|
||||
(let [maximum-size (or maximum-size 1.0)]
|
||||
(fn [y]
|
||||
(if (< y baseline) maximum-size
|
||||
(let [percent-complete (- 1.0 (/ (- y baseline) (- +screen-height+ baseline)))
|
||||
range (+ (* percent-complete (- maximum-size minimum-size)) minimum-size)]
|
||||
range)))))
|
||||
|
||||
(defn flip [anim]
|
||||
(animation (animation! anim :get-frame-duration)
|
||||
(for [src-frame (animation! anim :get-key-frames)
|
||||
:let [frame (texture (texture! src-frame :get-texture))]]
|
||||
(do
|
||||
(texture! frame :set-region src-frame)
|
||||
(texture! frame :flip true false)
|
||||
frame))))
|
||||
|
||||
Reference in New Issue
Block a user