added splash screens.
BIN
desktop/asset-work/dbh.png
Normal file
|
After Width: | Height: | Size: 5.1 KiB |
BIN
desktop/asset-work/pos.png
Normal file
|
After Width: | Height: | Size: 12 KiB |
|
Before Width: | Height: | Size: 215 KiB After Width: | Height: | Size: 204 KiB |
|
Before Width: | Height: | Size: 244 KiB After Width: | Height: | Size: 231 KiB |
|
Before Width: | Height: | Size: 204 KiB After Width: | Height: | Size: 258 KiB |
|
Before Width: | Height: | Size: 88 KiB After Width: | Height: | Size: 102 KiB |
|
Before Width: | Height: | Size: 110 KiB After Width: | Height: | Size: 80 KiB |
|
Before Width: | Height: | Size: 247 KiB After Width: | Height: | Size: 247 KiB |
|
Before Width: | Height: | Size: 102 KiB After Width: | Height: | Size: 97 KiB |
|
Before Width: | Height: | Size: 148 KiB After Width: | Height: | Size: 166 KiB |
|
Before Width: | Height: | Size: 153 KiB After Width: | Height: | Size: 135 KiB |
@@ -7,9 +7,9 @@
|
|||||||
[advent.screens.dialogue :as dialogue]
|
[advent.screens.dialogue :as dialogue]
|
||||||
[clojure.tools.logging :as log]
|
[clojure.tools.logging :as log]
|
||||||
[advent.screens.title :as title]
|
[advent.screens.title :as title]
|
||||||
|
[advent.screens.splash :as splash]
|
||||||
[advent.screens.credits :as credits]
|
[advent.screens.credits :as credits]
|
||||||
[advent.screens.inventory :as inventory]
|
[advent.screens.inventory :as inventory]
|
||||||
[advent.screens.safe :as safe]
|
|
||||||
[advent.steam :as steam]
|
[advent.steam :as steam]
|
||||||
[clojure.pprint]
|
[clojure.pprint]
|
||||||
[advent.pathfind])
|
[advent.pathfind])
|
||||||
@@ -28,7 +28,7 @@
|
|||||||
(fn [this]
|
(fn [this]
|
||||||
(clojure.tools.logging/log-capture! *ns* :warn :error)
|
(clojure.tools.logging/log-capture! *ns* :warn :error)
|
||||||
(steam/init)
|
(steam/init)
|
||||||
(set-screen! this title/title-screen)))
|
(set-screen! this splash/splash-screen)))
|
||||||
|
|
||||||
(defn reload []
|
(defn reload []
|
||||||
(on-gl (set-screen! advent title/title-screen)))
|
(on-gl (set-screen! advent title/title-screen)))
|
||||||
|
|||||||
88
desktop/src-common/advent/screens/splash.clj
Normal file
@@ -0,0 +1,88 @@
|
|||||||
|
(ns advent.screens.splash
|
||||||
|
(:require [clojure.string :as str]
|
||||||
|
[play-clj.core :refer :all]
|
||||||
|
[play-clj.math :refer :all]
|
||||||
|
[play-clj.ui :refer :all]
|
||||||
|
[play-clj.utils :refer :all]
|
||||||
|
[play-clj.g2d :refer :all]
|
||||||
|
[advent.utils :as utils]
|
||||||
|
[clojure.tools.logging :as log]
|
||||||
|
[advent.saves :as saves]
|
||||||
|
[advent.tween :as tween]
|
||||||
|
[advent.steam :as steam]
|
||||||
|
[advent.screens.title :as title]
|
||||||
|
)
|
||||||
|
(:import [com.badlogic.gdx.graphics Pixmap Pixmap$Filter Texture Texture$TextureFilter Color]
|
||||||
|
[com.badlogic.gdx.graphics.g2d TextureRegion]
|
||||||
|
[play_clj.entities NinePatchEntity]
|
||||||
|
[com.badlogic.gdx.utils.viewport FitViewport]
|
||||||
|
[com.badlogic.gdx.scenes.scene2d.ui Slider$SliderStyle Widget ButtonGroup TextButton$TextButtonStyle CheckBox$CheckBoxStyle CheckBox Button]
|
||||||
|
[com.badlogic.gdx.scenes.scene2d Group Actor]
|
||||||
|
[play_clj.entities ActorEntity]
|
||||||
|
[com.badlogic.gdx.scenes.scene2d.utils Align NinePatchDrawable TextureRegionDrawable]
|
||||||
|
[com.badlogic.gdx Application Audio Files Game Gdx Graphics Input
|
||||||
|
InputMultiplexer InputProcessor Net Preferences Screen]))
|
||||||
|
|
||||||
|
(defn fade-in [screen e thing then]
|
||||||
|
(assoc-in e [:tweens :fade-in]
|
||||||
|
(tween/tween :fade-in screen [thing :opacity] 0.0 1.0 2.0
|
||||||
|
:finish then
|
||||||
|
:ease tween/ease-in-quadratic)))
|
||||||
|
|
||||||
|
(defn fade-out [screen e thing then]
|
||||||
|
(assoc-in e [:tweens :fade-out]
|
||||||
|
(tween/tween :fade-out screen [thing :opacity] 1.0 0.0 2.0
|
||||||
|
:finish then
|
||||||
|
:ease tween/ease-in-quadratic)))
|
||||||
|
|
||||||
|
(defscreen splash-screen
|
||||||
|
:on-show
|
||||||
|
(fn [screen entities]
|
||||||
|
(utils/setup-viewport screen 1280 960)
|
||||||
|
(log/info "Starting splash screen.")
|
||||||
|
|
||||||
|
(input! :set-cursor-image (utils/cursor "cursor.png" :hourglass) 0 0)
|
||||||
|
|
||||||
|
(let [entities {:background (assoc (utils/get-texture "black.png")
|
||||||
|
:scale-x 80
|
||||||
|
:scale-y 80
|
||||||
|
:opacity 1.0
|
||||||
|
:origin-x 0
|
||||||
|
:origin-y 0
|
||||||
|
:z 0)
|
||||||
|
:poslogo (assoc (utils/get-texture "pos.png") :x 0 :y 0 :scale-x 4 :scale-y 4 :origin-x 0 :origin-y 0 :z 1 :opacity 0.0)
|
||||||
|
:dbhlogo (assoc (utils/get-texture "dbh.png") :x 0 :y 0 :scale-x 4 :scale-y 4 :origin-x 0 :origin-y 0 :z 1 :opacity 0.0)
|
||||||
|
}]
|
||||||
|
(fade-in screen entities :dbhlogo
|
||||||
|
(fn [entities]
|
||||||
|
(fade-out (assoc-in screen [:total-time] 2.0) entities :dbhlogo
|
||||||
|
(fn [entities]
|
||||||
|
(fade-in (assoc-in screen [:total-time] 4.0) entities :poslogo
|
||||||
|
(fn [entities]
|
||||||
|
(fade-out (assoc-in screen [:total-time] 6.0) entities :poslogo
|
||||||
|
(fn [entities]
|
||||||
|
(set-screen! @(resolve 'advent.core/advent) title/title-screen)
|
||||||
|
entities))))))))))
|
||||||
|
|
||||||
|
|
||||||
|
:on-render
|
||||||
|
(fn [{:keys [^FitViewport viewport] :as screen} [entities]]
|
||||||
|
(steam/update)
|
||||||
|
(.apply viewport)
|
||||||
|
(clear!)
|
||||||
|
(let [entities (utils/apply-tweens screen entities (:tweens entities))]
|
||||||
|
(render! screen (sort-by :z (filter :object (vals entities))) )
|
||||||
|
entities))
|
||||||
|
|
||||||
|
:show-screen (fn [entities]
|
||||||
|
entities)
|
||||||
|
|
||||||
|
:on-key-up
|
||||||
|
(fn [screen entities]
|
||||||
|
(when (= (key-code :escape) (:key screen))
|
||||||
|
(utils/toggle-fullscreen!))
|
||||||
|
nil)
|
||||||
|
|
||||||
|
:on-resize (fn [{:keys [viewport width height]} [entities]]
|
||||||
|
(.update viewport width height false)
|
||||||
|
nil))
|
||||||