fading covers all.
This commit is contained in:
40
desktop/src-common/advent/screens/fade.clj
Normal file
40
desktop/src-common/advent/screens/fade.clj
Normal 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)))
|
||||
|
||||
Reference in New Issue
Block a user