improving inventory item scales.
This commit is contained in:
@@ -146,7 +146,7 @@
|
||||
(Pixmap/setFilter Pixmap$Filter/NearestNeighbour)
|
||||
(pixmap! resized :draw-pixmap base-cursor (* index 18) 0 16 16
|
||||
0 0 target-width target-height)
|
||||
|
||||
|
||||
(graphics! :new-cursor resized (* hot-x scale) (* hot-y scale) )))
|
||||
|
||||
(defn get-texture [path]
|
||||
@@ -195,12 +195,12 @@
|
||||
(first (drop-while #{:fail}
|
||||
(repeatedly times
|
||||
#(try (fn)
|
||||
(catch Exception e
|
||||
(catch Exception e
|
||||
(log/error "Could not save!" e)
|
||||
:fail))))))
|
||||
|
||||
(defn save [entities id name & [blurb]]
|
||||
(let [save-fn (fn []
|
||||
(let [save-fn (fn []
|
||||
(log/info "Saving " id name)
|
||||
(let [save {:name name
|
||||
:id id
|
||||
@@ -209,7 +209,7 @@
|
||||
:x (get-in entities [:room :entities :ego :x])
|
||||
:y (get-in entities [:room :entities :ego :y]))
|
||||
:blurb (or blurb name)}]
|
||||
|
||||
|
||||
(steam/write-bytes (steam/save-file-name id) (.getBytes (pr-str save) "UTF-8"))
|
||||
(on-gl (let [gl-func (fn []
|
||||
(let [_ (Pixmap/setFilter Pixmap$Filter/BiLinear)
|
||||
@@ -244,7 +244,7 @@
|
||||
|
||||
(defn get-font [filename]
|
||||
(let [font (-> (bitmap-font filename)
|
||||
#_(doto (bitmap-font! :set-scale 0.5 0.5)))
|
||||
#_(doto (bitmap-font! :set-scale 0.5 0.5)))
|
||||
tr (bitmap-font! font :get-region)
|
||||
tx (.getTexture tr)]
|
||||
(call! ^Texture tx :set-filter Texture$TextureFilter/Linear Texture$TextureFilter/Linear)
|
||||
@@ -357,7 +357,7 @@
|
||||
|
||||
(defn find-override [entities [x y]]
|
||||
(first (concat (filter #(and ((:mouse-in? %) entities x y)
|
||||
|
||||
|
||||
(:override %))
|
||||
(get-in entities [:room :interactions]))
|
||||
(filter #(and (:mouse-in? %)
|
||||
@@ -390,7 +390,7 @@
|
||||
(doto (music (str r ".mp3")) (music! :set-looping true)))))
|
||||
|
||||
(defn load-sound [f]
|
||||
(try
|
||||
(try
|
||||
(sound f)
|
||||
(catch Exception e
|
||||
(log/info e)
|
||||
@@ -406,13 +406,13 @@
|
||||
|
||||
(defn intersects? [e [x y]]
|
||||
(when (:object e)
|
||||
(let [object-width (* (:scale-x e 1.0) (or (:width e) (when (actor? e ) (.getWidth ^Actor (:object e))) 0))
|
||||
object-height (* (:scale-y e 1.0) (or (:height e) (when (actor? e ) (.getHeight ^Actor (:object e))) 0))
|
||||
(let [object-width (* (:scale-x e 1.0) (or (:intersect-width e) (:width e) (when (actor? e ) (.getWidth ^Actor (:object e))) 0))
|
||||
object-height (* (:scale-y e 1.0) (or (:intersect-height e) (:height e) (when (actor? e ) (.getHeight ^Actor (:object e))) 0))
|
||||
origin-x (* (:scale-x e 1.0) (:origin-x e 0))
|
||||
origin-y (* (:scale-y e 1.0) (:origin-y e 0))
|
||||
object-x (- (or (:x e) (when (actor? e ) (.getX ^Actor (:object e))) 0) origin-x)
|
||||
object-y (- (or (:y e) (when (actor? e ) (.getY ^Actor (:object e))) 0) origin-y)]
|
||||
|
||||
|
||||
(and (:object e)
|
||||
(< object-x x (+ object-x object-width))
|
||||
(< object-y y (+ object-y object-height))))))
|
||||
@@ -434,7 +434,7 @@
|
||||
(.apply viewport)
|
||||
(assoc screen :renderer stage :viewport viewport :camera cam)))
|
||||
|
||||
(defn unproject
|
||||
(defn unproject
|
||||
([screen options]
|
||||
(unproject screen options [(:input-x options) (:input-y options)]) )
|
||||
([screen options [x y]]
|
||||
@@ -443,7 +443,7 @@
|
||||
y (.y pj)]
|
||||
[x y])))
|
||||
|
||||
(defn project
|
||||
(defn project
|
||||
([screen [x y]]
|
||||
(let [pj (.project ^FitViewport (:viewport screen) (vector-2 x y))
|
||||
x (.x pj)
|
||||
@@ -470,12 +470,12 @@
|
||||
hovering-ego (hovering-ego entities last-pos)
|
||||
current (get-in entities [:cursor :current])
|
||||
entities (assoc-in entities [:label :text] "")
|
||||
selected-inventory-item (@(resolve 'advent.screens.scene/get-selected-inventory-item))]
|
||||
|
||||
selected-inventory-item (@(resolve 'advent.screens.scene/get-selected-inventory-item))]
|
||||
|
||||
(cond
|
||||
out-of-bounds
|
||||
(update-in entities [:cursor] assoc :override nil :active false )
|
||||
|
||||
|
||||
|
||||
(not (get-in entities [:state :active?]))
|
||||
(-> entities
|
||||
@@ -526,9 +526,9 @@
|
||||
|
||||
(defn fast-forward-particle [p]
|
||||
(particle-effect! p :reset)
|
||||
(particle-effect! p :start)
|
||||
(particle-effect! p :start)
|
||||
|
||||
(particle-effect! p :update 10.0)
|
||||
(particle-effect! p :update 10.0)
|
||||
(dotimes [_ 160]
|
||||
(particle-effect! p :update 0.2)))
|
||||
|
||||
@@ -633,7 +633,7 @@
|
||||
(play-sound! screen entities snd volume-fn pan type 1.0))
|
||||
|
||||
([screen entities snd volume-fn pan type pitch]
|
||||
|
||||
|
||||
(let [vol (volume-fn entities)
|
||||
snd (if (keyword? snd)
|
||||
(or (-> entities :room :sounds snd)
|
||||
|
||||
Reference in New Issue
Block a user