switchable screen size.
This commit is contained in:
@@ -1 +1 @@
|
|||||||
{:sound-volume 64.0, :music-volume 55.0}
|
{:sound-volume 64.0, :music-volume 0.0}
|
||||||
@@ -741,6 +741,7 @@ void main()
|
|||||||
|
|
||||||
:on-show
|
:on-show
|
||||||
(fn [screen entities]
|
(fn [screen entities]
|
||||||
|
|
||||||
(let [screen (assoc screen :total-time 0)]
|
(let [screen (assoc screen :total-time 0)]
|
||||||
(let [[cam] (utils/setup-viewport screen 320 240)]
|
(let [[cam] (utils/setup-viewport screen 320 240)]
|
||||||
(set! (. cam zoom) 0.95)
|
(set! (. cam zoom) 0.95)
|
||||||
|
|||||||
@@ -70,15 +70,18 @@
|
|||||||
(utils/setup-viewport screen 1280 960)
|
(utils/setup-viewport screen 1280 960)
|
||||||
(utils/load-settings!)
|
(utils/load-settings!)
|
||||||
(let [font (utils/get-font "ego/font.fnt")
|
(let [font (utils/get-font "ego/font.fnt")
|
||||||
start-playing (assoc (label "Begin quest" (style :label font (color 0.6 1.0 1.0 1.0))) :x 0 :y 280 :height 64 :origin-x 0 :origin-y 0)
|
start-playing (assoc (label "Begin quest" (style :label font (color 0.6 1.0 1.0 1.0))) :x 0 :y 280 :height 32 :origin-x 0 :origin-y 0)
|
||||||
start-playing (center start-playing)
|
start-playing (center start-playing)
|
||||||
quit (assoc (label "End quest" (style :label font (color 0.6 1.0 1.0 1.0))) :x 0 :y (- 280 (* 32 5)) :height 32 :origin-x 0 :origin-y 0)
|
fullscreen (assoc (label "Windowed" (style :label font (color 0.6 1.0 1.0 1.0))) :x 0 :y (- 280 (* 32 5)) :height 32 :origin-x 0 :origin-y 0)
|
||||||
|
fullscreen (center fullscreen)
|
||||||
|
quit (assoc (label "End quest" (style :label font (color 0.6 1.0 1.0 1.0))) :x 0 :y (- 280 (* 32 6)) :height 32 :origin-x 0 :origin-y 0)
|
||||||
quit (center quit)
|
quit (center quit)
|
||||||
music (utils/make-music "intro.ogg")
|
music (utils/make-music "intro.ogg")
|
||||||
ui-skin (skin "ui/ui.json")
|
ui-skin (skin "ui/ui.json")
|
||||||
]
|
]
|
||||||
(label! start-playing :set-alignment Align/center)
|
(label! start-playing :set-alignment Align/center)
|
||||||
(label! quit :set-alignment Align/center)
|
(label! quit :set-alignment Align/center)
|
||||||
|
(label! fullscreen :set-alignment Align/center)
|
||||||
|
|
||||||
{:overlay (assoc (texture "title.png" ) :x 0 :y 0 :scale-x 4 :scale-y 4 :origin-x 0 :origin-y 0)
|
{:overlay (assoc (texture "title.png" ) :x 0 :y 0 :scale-x 4 :scale-y 4 :origin-x 0 :origin-y 0)
|
||||||
:fade (assoc (texture "black.png")
|
:fade (assoc (texture "black.png")
|
||||||
@@ -99,7 +102,7 @@
|
|||||||
:y 650)
|
:y 650)
|
||||||
:clouds (assoc (particle-effect "titleclouds" :reset :start) :x 640 :y 480 )
|
:clouds (assoc (particle-effect "titleclouds" :reset :start) :x 640 :y 480 )
|
||||||
:toolbox (center (assoc (nine-patch {:region (:object (texture "talk-bg-2.png")) :left 9 :top 9 :right 9 :bottom 9})
|
:toolbox (center (assoc (nine-patch {:region (:object (texture "talk-bg-2.png")) :left 9 :top 9 :right 9 :bottom 9})
|
||||||
:y 90 :width 500 :height 250))
|
:y 58 :width 500 :height 282))
|
||||||
|
|
||||||
:music-label (-> (label "Music" (style :label font (color 1.0 1.0 1.0 1.0)))
|
:music-label (-> (label "Music" (style :label font (color 1.0 1.0 1.0 1.0)))
|
||||||
(assoc :x 0 :y (- 280 (* 32 1)) :height 32 :origin-x 0 :origin-y 0)
|
(assoc :x 0 :y (- 280 (* 32 1)) :height 32 :origin-x 0 :origin-y 0)
|
||||||
@@ -129,6 +132,7 @@
|
|||||||
:volume 1.0
|
:volume 1.0
|
||||||
:start-playing start-playing
|
:start-playing start-playing
|
||||||
:quit quit
|
:quit quit
|
||||||
|
:fullscreen fullscreen
|
||||||
:tweens {:fade-in (tween/tween :fade-in screen [:fade :opacity] 1.0 0.0 1.0
|
:tweens {:fade-in (tween/tween :fade-in screen [:fade :opacity] 1.0 0.0 1.0
|
||||||
:finish #(do (utils/play-sound (:music %)) %)
|
:finish #(do (utils/play-sound (:music %)) %)
|
||||||
:ease tween/ease-in-quadratic)}}))
|
:ease tween/ease-in-quadratic)}}))
|
||||||
@@ -141,7 +145,7 @@
|
|||||||
entities (fly-ego screen entities)]
|
entities (fly-ego screen entities)]
|
||||||
(music! (:music entities) :set-volume (utils/current-music-volume (:volume entities)))
|
(music! (:music entities) :set-volume (utils/current-music-volume (:volume entities)))
|
||||||
|
|
||||||
(render! screen [(:overlay entities) (:clouds entities) (:flying-ego entities) (:toolbox entities) (:start-playing entities) (:quit entities) (:music-label entities) (:music-volume-slider entities) (:sound-label entities) (:sound-volume-slider entities) (:fade entities) ])
|
(render! screen [(:overlay entities) (:clouds entities) (:flying-ego entities) (:toolbox entities) (:start-playing entities) (:quit entities) (:fullscreen entities) (:music-label entities) (:music-volume-slider entities) (:sound-label entities) (:sound-volume-slider entities) (:fade entities) ])
|
||||||
entities))
|
entities))
|
||||||
|
|
||||||
:show-screen (fn [entities]
|
:show-screen (fn [entities]
|
||||||
@@ -150,6 +154,7 @@
|
|||||||
:on-mouse-moved (fn [screen [entities]]
|
:on-mouse-moved (fn [screen [entities]]
|
||||||
(let [[x y] (utils/unproject screen)]
|
(let [[x y] (utils/unproject screen)]
|
||||||
(style-label (:start-playing entities) (get-in entities [:font]) [x y])
|
(style-label (:start-playing entities) (get-in entities [:font]) [x y])
|
||||||
|
(style-label (:fullscreen entities) (get-in entities [:font]) [x y])
|
||||||
(style-label (:quit entities) (get-in entities [:font]) [x y])
|
(style-label (:quit entities) (get-in entities [:font]) [x y])
|
||||||
(style-slider (:music-volume-slider entities) [x y])
|
(style-slider (:music-volume-slider entities) [x y])
|
||||||
(style-slider (:sound-volume-slider entities) [x y])
|
(style-slider (:sound-volume-slider entities) [x y])
|
||||||
@@ -160,6 +165,7 @@
|
|||||||
assoc
|
assoc
|
||||||
:music-volume (slider! (:music-volume-slider entities) :get-value)
|
:music-volume (slider! (:music-volume-slider entities) :get-value)
|
||||||
:sound-volume (slider! (:sound-volume-slider entities) :get-value))
|
:sound-volume (slider! (:sound-volume-slider entities) :get-value))
|
||||||
|
|
||||||
(utils/save-settings!)
|
(utils/save-settings!)
|
||||||
entities)
|
entities)
|
||||||
|
|
||||||
@@ -187,6 +193,15 @@
|
|||||||
entities)
|
entities)
|
||||||
:ease tween/ease-in-cubic)))
|
:ease tween/ease-in-cubic)))
|
||||||
|
|
||||||
|
(utils/intersects? (:fullscreen entities) [x y])
|
||||||
|
(if (.isFullscreen Gdx/graphics)
|
||||||
|
(on-gl (.setDisplayMode Gdx/graphics 1280 960 false)
|
||||||
|
(label! (:fullscreen entities) set-text "Windowed"))
|
||||||
|
(on-gl (.setDisplayMode Gdx/graphics
|
||||||
|
(.width (.getDesktopDisplayMode Gdx/graphics))
|
||||||
|
(.height (.getDesktopDisplayMode Gdx/graphics))
|
||||||
|
true)
|
||||||
|
(label! (:fullscreen entities) set-text "Fullscreen")))
|
||||||
:else
|
:else
|
||||||
nil))))
|
nil))))
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,8 @@
|
|||||||
(:require [advent.core :refer :all]
|
(:require [advent.core :refer :all]
|
||||||
[clojure.tools.nrepl.server])
|
[clojure.tools.nrepl.server])
|
||||||
(:import [com.badlogic.gdx.backends.lwjgl LwjglApplication LwjglApplicationConfiguration]
|
(:import [com.badlogic.gdx.backends.lwjgl LwjglApplication LwjglApplicationConfiguration]
|
||||||
[org.lwjgl.input Keyboard])
|
[org.lwjgl.input Keyboard]
|
||||||
|
[com.badlogic.gdx Gdx])
|
||||||
(:gen-class))
|
(:gen-class))
|
||||||
|
|
||||||
(defmacro start-nrepl-expr [port]
|
(defmacro start-nrepl-expr [port]
|
||||||
@@ -14,6 +15,8 @@
|
|||||||
(spit port#)))
|
(spit port#)))
|
||||||
(println "Started nREPL server on port" port#)))
|
(println "Started nREPL server on port" port#)))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
(defn -main
|
(defn -main
|
||||||
[& [port]]
|
[& [port]]
|
||||||
(when port (start-nrepl-expr (Integer/parseInt port)))
|
(when port (start-nrepl-expr (Integer/parseInt port)))
|
||||||
@@ -26,4 +29,5 @@
|
|||||||
(LwjglApplication. advent "advent" 1280 960))
|
(LwjglApplication. advent "advent" 1280 960))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
(Keyboard/enableRepeatEvents true))
|
(Keyboard/enableRepeatEvents true))
|
||||||
|
|||||||
Reference in New Issue
Block a user