beginning on inventory screen.
This commit is contained in:
50
desktop/src-common/advent/screens/inventory.clj
Normal file
50
desktop/src-common/advent/screens/inventory.clj
Normal file
@@ -0,0 +1,50 @@
|
||||
(ns advent.screens.inventory
|
||||
(:require [play-clj.core :refer :all]
|
||||
[play-clj.ui :refer :all]
|
||||
[play-clj.utils :refer :all]
|
||||
[play-clj.g2d :refer :all]
|
||||
[clojure.pprint]
|
||||
[advent.pathfind])
|
||||
(:import [com.badlogic.gdx.graphics Pixmap Pixmap$Filter Texture Texture$TextureFilter]
|
||||
[com.badlogic.gdx.graphics.g2d TextureRegion]
|
||||
[com.badlogic.gdx.scenes.scene2d.utils Align]
|
||||
[com.badlogic.gdx Application Audio Files Game Gdx Graphics Input
|
||||
InputMultiplexer InputProcessor Net Preferences Screen]))
|
||||
|
||||
|
||||
(defscreen inventory-screen
|
||||
:on-show
|
||||
(fn [screen entities]
|
||||
(update! screen :renderer (stage) :camera (orthographic))
|
||||
{:overlay (assoc (texture "inventory-overlay.png" ) :x 0 :y 0)
|
||||
:fade (assoc (texture "black.png")
|
||||
:scale-x 20
|
||||
:scale-y 20
|
||||
:opacity 0.4)
|
||||
:shown? false
|
||||
:start-showing? false})
|
||||
|
||||
:on-render
|
||||
(fn [screen [entities]]
|
||||
(let [entities (if (:start-showing? entities)
|
||||
(-> entities
|
||||
(assoc :start-showing? false)
|
||||
(assoc :shown? true))
|
||||
entities)]
|
||||
|
||||
(when (:shown? entities)
|
||||
(render! screen [(:fade entities) (:overlay entities)]))
|
||||
entities))
|
||||
|
||||
:show-screen (fn [screen [entities]]
|
||||
(assoc entities :start-showing? true))
|
||||
|
||||
:on-touch-down (fn [screen [entities]]
|
||||
(when (:shown? entities)
|
||||
(-> entities
|
||||
(assoc :shown? false)
|
||||
(assoc :start-showing? false))))
|
||||
|
||||
:on-resize (fn [screen entities]
|
||||
(size! screen 320 240)
|
||||
entities))
|
||||
Reference in New Issue
Block a user