defaults to fullscreen.
This commit is contained in:
@@ -201,8 +201,7 @@
|
||||
:on-show
|
||||
(fn [screen entities]
|
||||
(utils/setup-viewport screen 1280 960)
|
||||
(when (utils/has-saved-settings?)
|
||||
(utils/load-settings!))
|
||||
|
||||
(let [font (utils/get-font "ego/font.fnt")
|
||||
music (utils/make-music "music/intro.ogg")
|
||||
balloon (utils/make-anim "title/balloon.png" [15 30] 0.45 (range 4))
|
||||
|
||||
@@ -26,7 +26,8 @@
|
||||
(def +all-cursors+ [:main :wool :mushrooms :carrot :right :down :left :up :flask :flask-with-contents :trophy :ladder :stick :cat-toy :balloon :frog-legs :teddy :portrait :recipe :glass-eye :motivational-tapes :used-earplugs :grass :slobber :flask-with-strength :medal :kiss :sword :hourglass :mandrake :ball-n-chain :key :rope :crowbar :note-1 :ash :sack-lunch :flies :spear :monocle :feather :spell-component :money :watch :broken-clock :slingshot :camera :walkie-talkies :alarm-clock :walkie-talkie :flask-water :flask-water-stuff :flask-water-stuff-2 :note-2 :magic-slingshot :active-main :shovel :broom])
|
||||
|
||||
(def settings (atom {:music-volume 50.0
|
||||
:sound-volume 75.0}))
|
||||
:sound-volume 75.0
|
||||
:fullscreen true}))
|
||||
|
||||
(def selected-save (atom nil))
|
||||
|
||||
@@ -392,17 +393,29 @@
|
||||
(dotimes [_ 160]
|
||||
(particle-effect! p :update 0.2)))
|
||||
|
||||
|
||||
(defn set-fullscreen! [val]
|
||||
(try
|
||||
(if val
|
||||
(on-gl (.setDisplayMode Gdx/graphics
|
||||
(doto (.width (.getDesktopDisplayMode Gdx/graphics)) println)
|
||||
(doto (.height (.getDesktopDisplayMode Gdx/graphics)) println)
|
||||
true)
|
||||
(set! (.foregroundFPS (-> (class Gdx/graphics)
|
||||
(.getDeclaredField (name "config"))
|
||||
(doto (.setAccessible true))
|
||||
(.get Gdx/graphics))) 60))
|
||||
(on-gl (.setDisplayMode Gdx/graphics 1280 960 false)))
|
||||
(swap! settings assoc :fullscreen val)
|
||||
(save-settings!)
|
||||
nil
|
||||
(catch Exception e
|
||||
(println e))))
|
||||
|
||||
(defn toggle-fullscreen! []
|
||||
(if (.isFullscreen Gdx/graphics)
|
||||
(on-gl (.setDisplayMode Gdx/graphics 1280 960 false))
|
||||
(on-gl (.setDisplayMode Gdx/graphics
|
||||
(doto (.width (.getDesktopDisplayMode Gdx/graphics)) println)
|
||||
(doto (.height (.getDesktopDisplayMode Gdx/graphics)) println)
|
||||
true)
|
||||
(set! (.foregroundFPS (-> (class Gdx/graphics)
|
||||
(.getDeclaredField (name "config"))
|
||||
(doto (.setAccessible true))
|
||||
(.get Gdx/graphics))) 60))))
|
||||
(set-fullscreen! false)
|
||||
(set-fullscreen! true)))
|
||||
|
||||
(defn get-sound-pan [x]
|
||||
(/ (- x 160 ) 160))
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
(ns advent.core.desktop-launcher
|
||||
(:require [advent.core :refer :all]
|
||||
[advent.utils :as utils]
|
||||
#_[clojure.tools.nrepl.server])
|
||||
(:import [com.badlogic.gdx.backends.lwjgl LwjglApplication LwjglApplicationConfiguration]
|
||||
[org.lwjgl.input Keyboard]
|
||||
@@ -39,7 +40,12 @@
|
||||
(System/setProperty "org.lwjgl.opengl.Display.disableOSXFullscreenModeAPI" "true")
|
||||
#_(System/setProperty "org.lwjgl.opengl.Window.undecorated", "true")
|
||||
|
||||
(LwjglApplication. advent cfg))
|
||||
(let [app (LwjglApplication. advent cfg)]
|
||||
(when (utils/has-saved-settings?)
|
||||
(utils/load-settings!))
|
||||
(utils/set-fullscreen! (:fullscreen @utils/settings))
|
||||
|
||||
app))
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user