50 lines
1.8 KiB
Clojure
50 lines
1.8 KiB
Clojure
(ns advent.screens.credits
|
|
(: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.tween :as tween]
|
|
[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.utils.viewport FitViewport]
|
|
[com.badlogic.gdx Application Audio Files Game Gdx Graphics Input
|
|
InputMultiplexer InputProcessor Net Preferences Screen]))
|
|
|
|
|
|
(defscreen credits
|
|
:on-show
|
|
(fn [screen entities]
|
|
(utils/setup-viewport screen 320 240)
|
|
(input! :set-cursor-image (utils/cursor "cursor.png" :main) 0 0)
|
|
{:fade (assoc (texture "black.png")
|
|
:scale-x 80
|
|
:scale-y 80
|
|
:opacity 0.0
|
|
:origin-x 0
|
|
:origin-y 0)
|
|
:the-end (assoc (texture "the-end.png") :x 0 :y 0)
|
|
:tweens {:fade-in
|
|
(tween/tween :fade-in screen [:fade :opacity] 1.0 0.0 5.0 :ease tween/ease-out-cubic)}}
|
|
)
|
|
|
|
:on-render
|
|
(fn [{:keys [^FitViewport viewport] :as screen} [entities]]
|
|
(.apply viewport)
|
|
(let [entities (utils/apply-tweens screen entities (:tweens entities))]
|
|
|
|
(render! screen [(:the-end entities) (:fade entities)])
|
|
entities))
|
|
|
|
|
|
:on-touch-up (fn [screen [entities]]
|
|
(set-screen! @(resolve 'advent.core/advent) @(resolve 'advent.screens.title/title-screen)))
|
|
|
|
:on-resize (fn [{:keys [width height viewport]} entities]
|
|
(.update viewport width height)))
|
|
|