Add mutations to the image function
This commit is contained in:
@@ -33,22 +33,25 @@
|
|||||||
; textures
|
; textures
|
||||||
|
|
||||||
(defn image
|
(defn image
|
||||||
[val]
|
[val & {:keys [] :as options}]
|
||||||
(if (string? val)
|
(let [^TextureRegion
|
||||||
(-> ^String val Texture. TextureRegion.)
|
img (if (string? val)
|
||||||
(TextureRegion. ^TextureRegion val)))
|
(-> ^String val Texture. TextureRegion.)
|
||||||
|
(TextureRegion. ^TextureRegion val))]
|
||||||
|
(doseq [[k v] options]
|
||||||
|
(case k
|
||||||
|
:width (.setRegionWidth img v)
|
||||||
|
:height (.setRegionHeight img v)
|
||||||
|
nil))
|
||||||
|
img))
|
||||||
|
|
||||||
(defn image-width
|
(defn image-width
|
||||||
([^TextureRegion img]
|
[^TextureRegion img]
|
||||||
(.getRegionWidth img))
|
(.getRegionWidth img))
|
||||||
([img val]
|
|
||||||
(doto ^TextureRegion (image img) (.setRegionWidth val))))
|
|
||||||
|
|
||||||
(defn image-height
|
(defn image-height
|
||||||
([^TextureRegion img]
|
[^TextureRegion img]
|
||||||
(.getRegionHeight img))
|
(.getRegionHeight img))
|
||||||
([img val]
|
|
||||||
(doto ^TextureRegion (image img) (.setRegionHeight val))))
|
|
||||||
|
|
||||||
(defn split-image
|
(defn split-image
|
||||||
([val size]
|
([val size]
|
||||||
|
|||||||
Reference in New Issue
Block a user