fading covers all.

This commit is contained in:
2015-05-01 18:09:03 -07:00
parent 8fe72959d2
commit 23d90e1a05
3 changed files with 46 additions and 8 deletions

View File

@@ -0,0 +1,40 @@
(ns advent.screens.fade
(: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]
[advent.zone :as zone]
[advent.utils :as utils])
(: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 fade-screen
:on-show
(fn [screen entities]
(utils/setup-viewport screen 320 240)
{:fade (assoc (texture "black.png")
:scale-x 80
:scale-y 80
:opacity 0.0
:origin-x 0
:origin-y 0)})
:on-render
(fn [screen [entities]]
(render! screen [(:fade entities)])
entities)
:update-fade (fn [{:keys [opacity]} [entities]]
(assoc-in entities [:fade :opacity] opacity))
:on-resize (fn [{:keys [width height viewport]} entities]
(.update viewport width height)))