prepping for inventory rehash.

This commit is contained in:
2016-07-27 21:46:23 -07:00
parent ce3e16613e
commit 7d0bdcb173
34 changed files with 566 additions and 383 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.0 KiB

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -0,0 +1,58 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<array>
<dict>
<key>duration</key>
<real>1</real>
</dict>
<dict>
<key>duration</key>
<real>1</real>
</dict>
<dict>
<key>duration</key>
<real>1</real>
</dict>
<dict>
<key>duration</key>
<real>1</real>
</dict>
<dict>
<key>duration</key>
<real>1</real>
</dict>
<dict>
<key>duration</key>
<real>1</real>
</dict>
<dict>
<key>duration</key>
<real>1</real>
</dict>
<dict>
<key>duration</key>
<real>1</real>
</dict>
<dict>
<key>duration</key>
<real>1</real>
</dict>
<dict>
<key>duration</key>
<real>1</real>
</dict>
<dict>
<key>duration</key>
<real>1</real>
</dict>
<dict>
<key>duration</key>
<real>1</real>
</dict>
<dict>
<key>duration</key>
<real>1</real>
</dict>
</array>
</plist>

File diff suppressed because it is too large Load Diff

Binary file not shown.

Before

Width:  |  Height:  |  Size: 674 KiB

After

Width:  |  Height:  |  Size: 676 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 608 KiB

After

Width:  |  Height:  |  Size: 608 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 406 KiB

After

Width:  |  Height:  |  Size: 414 KiB

View File

@@ -1354,6 +1354,7 @@ void main ()
:on-reactivate (fn [screen [entities]]
(screen! hud :on-reactivate)
(-> entities
(assoc-in [:state :active?] true)
(assoc-in [:cursor :override] nil)))
@@ -1366,6 +1367,7 @@ void main ()
(assoc-in [:cursor :override] nil)))
:on-chose-item (fn [{:keys [item]} [entities]]
(screen! hud :on-chose-item :item item)
(assoc-in entities [:cursor :current] item))
:on-show-inventory (fn [screen [entities]]
@@ -1453,6 +1455,7 @@ void main ()
(utils/setup-viewport screen 320 240)
{:already-saved? false
:opening-inventory? false
:close (assoc (utils/get-texture "close.png")
:x 304 :y 224
:width 16 :height 16
@@ -1464,14 +1467,22 @@ void main ()
:baseline 9000
:opacity 0.8)
:inventory (assoc (utils/get-texture "inventory.png") :x 278 :y 0 :baseline 9000
:open (utils/make-anim-seq "open-inventory" [42 56] 0.055 (flatten [(range 6) 6 7 8 7 ]))
:anim (utils/make-anim "inventory.png" [42 56] 0.1 [0])
:default (utils/make-anim "inventory.png" [42 56] 0.1 [0])
:opened (utils/make-anim-seq "open-inventory" [42 56] 0.1 [7])
:closing (utils/make-anim-seq "open-inventory" [42 56] 0.055 [9 10 11 12 0])
:anim-start 0
:mouse-in? (zone/box 278 0 320 42)
:opacity 0.8)
:all-items (texture! (texture (pixmap "cursor.png")) :split 18 16)
#_#_:fps (assoc (label "" (color :white) ) :x 5 :baseline 0 :opacity 0.1)}))
:on-render
(fn [{:keys [^FitViewport viewport] :as screen} [entities]]
(.apply viewport)
(let [entities (utils/apply-tweens screen entities (:tweens entities))
entities (update-in entities [:inventory] animate screen )
hud-interactable? (hud-interactable?)
entities (if hud-interactable?
(as-> entities entities
@@ -1484,14 +1495,35 @@ void main ()
(update-in entities [:save] assoc :r 1.0 :g 1.0 :b 1.0 ))
(as-> entities entities
(update-in entities [:save] assoc :r 0.75 :g 0.75 :b 0.75)
(grow-hud screen entities :save false)))]
(grow-hud screen entities :save false)))
entities (if (and (= (get-in entities [:inventory :anim])
(get-in entities [:inventory :closing]))
(animation! (get-in entities [:inventory :closing])
:is-animation-finished
(- (+ (:delta-time screen) (:total-time screen)) (get-in entities [:inventory :anim-start]))))
(-> entities
(update-in [:inventory] #(actions/start-animation screen % :default)))
entities)
entities (if (and (:opening-inventory? entities)
(animation! (get-in entities [:inventory :open])
:is-animation-finished
(- (+ (:delta-time screen) (:total-time screen)) (get-in entities [:inventory :anim-start]))))
(do
(screen! scene :on-show-inventory)
(-> entities
(assoc :opening-inventory? false)
(assoc-in [:inventory :anim] (get-in entities [:inventory :opened]))))
entities)]
#_(label! (:fps entities) :set-text (str (game :fps)))
(render! screen [ (if (and hud-interactable? (not (:already-saved? entities)))
(:save entities)
(assoc (:save entities) :opacity 0.5))
(if hud-interactable?
(:inventory entities)
(assoc (:inventory entities) :opacity 0.5))
(:selected-item entities)
(:close entities)])
entities))
@@ -1503,6 +1535,18 @@ void main ()
(fn [_ [entities]]
(assoc-in entities [:already-saved?] false))
:on-chose-item
(fn [{:keys [item]} [entities]]
(println utils/+all-cursors+ (.indexOf utils/+all-cursors+ :ball-n-chain) (.indexOf utils/+all-cursors+ (:cursor item) ) (:all-items entities))
(assoc entities :selected-item
(doto (assoc (texture (aget (get-in entities [:all-items ]) 0 (.indexOf utils/+all-cursors+ (:cursor item))))
:x 295 :y 40 :baseline 9000 :opacity 1.0) println)
))
:on-reactivate
(fn [screen [entities]]
(update-in entities [:inventory] #(actions/start-animation screen % :closing)))
:on-mouse-moved
(fn [screen [entities]]
(let [[x y] (utils/unproject screen)
@@ -1532,16 +1576,23 @@ void main ()
(fn [screen [entities]]
(if (= (button-code :left) (:button screen))
(let [[x y] (utils/unproject screen)]
(cond ((:mouse-in? (:inventory entities)) x y)
(screen! scene :on-show-inventory)
(cond
(not (hud-interactable?))
nil
(utils/intersects? (:close entities) [x y])
(screen! scene :on-menu)
((:mouse-in? (:inventory entities)) x y)
(-> entities
(update-in [:inventory] #(actions/start-animation screen % :open))
(assoc :opening-inventory? true))
(and (not (:already-saved? entities)) (utils/intersects? (:save entities) [x y]) (hud-interactable?))
(do
(screen! scene :on-save)
(assoc entities :already-saved? true))
(utils/intersects? (:close entities) [x y])
(screen! scene :on-menu)
:else
nil)))))
(and (not (:already-saved? entities)) (utils/intersects? (:save entities) [x y]) (hud-interactable?))
(do
(screen! scene :on-save)
(assoc entities :already-saved? true))
:else
nil)))))

View File

@@ -451,29 +451,26 @@
(do
(log/info "Making windowed 800x600 decorated window")
(System/setProperty "org.lwjgl.opengl.Window.undecorated", "false")
(.setDisplayMode Gdx/graphics 800 600 false)))
(.setFullscreenMode Gdx/graphics 800 600)))
(defmethod make-fullscreen :linux []
(let [width (-> Gdx/graphics .getDesktopDisplayMode .width)
height (-> Gdx/graphics .getDesktopDisplayMode .height)]
(let [width (-> Gdx/graphics .getDisplayMode .width)
height (-> Gdx/graphics .getDisplayMode .height)]
(log/info "Making fullscreen " width "x" height " as undecorated window")
(System/setProperty "org.lwjgl.opengl.Window.undecorated", "true")
(.setDisplayMode Gdx/graphics
(.setFullscreenMode Gdx/graphics
width
height
false)))
height)))
(defmethod is-fullscreen? :linux []
(= "true" (System/getProperty "org.lwjgl.opengl.Window.undecorated")))
(defn make-fullscreen-normal []
(let [width (-> Gdx/graphics .getDesktopDisplayMode .width)
height (-> Gdx/graphics .getDesktopDisplayMode .height)]
(let [width (-> Gdx/graphics .getDisplayMode .width)
height (-> Gdx/graphics .getDisplayMode .height)]
(log/info "Making fullscreen " width "x" height " as true fullscreen")
(.setDisplayMode Gdx/graphics
width
height
true)
(.setFullscreenMode Gdx/graphics
(.getDisplayMode Gdx/graphics))
(set! (.foregroundFPS (-> (class Gdx/graphics)
(.getDeclaredField (name "config"))
(doto (.setAccessible true))