Files
gitea-docker/desktop/src-common/advent/screens/inventory.clj
2014-09-20 22:28:10 -07:00

51 lines
1.7 KiB
Clojure

(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.7)
: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))