easily swappable fullscreen.

This commit is contained in:
Bryce Covert
2015-09-04 16:31:45 -07:00
parent a63a5352c1
commit fc258628c8
5 changed files with 40 additions and 30 deletions

View File

@@ -12,6 +12,8 @@
[com.badlogic.gdx.graphics.g2d TextureRegion]
[com.badlogic.gdx.utils.viewport FitViewport]
[com.badlogic.gdx.scenes.scene2d Actor Stage]
[com.badlogic.gdx Application Audio Files Game Gdx Graphics Input
InputMultiplexer InputProcessor Net Preferences Screen]
[java.lang Object]))
(defn log-coords [screen entities]
@@ -316,3 +318,15 @@
(particle-effect! p :update 10.0)
(dotimes [_ 160]
(particle-effect! p :update 0.2)))
(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))))