59 lines
1.9 KiB
Clojure
59 lines
1.9 KiB
Clojure
(ns advent.core.desktop-launcher
|
|
(:require [advent.core :refer :all]
|
|
[advent.utils :as utils]
|
|
[play-clj.core :refer :all])
|
|
(:import [com.badlogic.gdx.backends.lwjgl LwjglApplication LwjglApplicationConfiguration]
|
|
[org.lwjgl.input Keyboard]
|
|
[com.badlogic.gdx Gdx Files$FileType])
|
|
(:gen-class))
|
|
|
|
|
|
|
|
(def has-nrepl?
|
|
(try
|
|
(require '[play-clj-nrepl.core :as a])
|
|
(System/getProperty "use-repl")
|
|
(catch Exception e
|
|
(println e)
|
|
false)))
|
|
|
|
(defn -main
|
|
[& [port]]
|
|
(when has-nrepl?
|
|
(play-clj-nrepl.core/start-nrepl advent.core/advent port))
|
|
|
|
|
|
(let [cfg (LwjglApplicationConfiguration.)]
|
|
#_(println (.exists (files! :classpath "icon/icon_128x128.png")))
|
|
(.addIcon cfg "icon/icon_128x128.png" Files$FileType/Classpath)
|
|
(.addIcon cfg "icon/icon_32x32.png" Files$FileType/Classpath)
|
|
(.addIcon cfg "icon/icon_16x16.png" Files$FileType/Classpath)
|
|
|
|
(if false
|
|
(do
|
|
(set! (.width cfg) (doto (.width (LwjglApplicationConfiguration/getDesktopDisplayMode)) println))
|
|
(set! (.height cfg) (doto (.height (LwjglApplicationConfiguration/getDesktopDisplayMode)) println))
|
|
(set! (.resizable cfg) true)
|
|
(set! (.useHDPI cfg) false)
|
|
(set! (.fullscreen cfg) true))
|
|
(do
|
|
(set! (.width cfg) 1280)
|
|
(set! (.height cfg) 960)))
|
|
(set! (.title cfg) "Tick's Tales: Up All Knight")
|
|
(set! (.foregroundFPS cfg) 60)
|
|
(set! (.backgroundFPS cfg) 60)
|
|
(System/setProperty "org.lwjgl.opengl.Display.enableHighDPI" "false")
|
|
(System/setProperty "org.lwjgl.opengl.Display.disableOSXFullscreenModeAPI" "true")
|
|
#_(System/setProperty "org.lwjgl.opengl.Window.undecorated", "true")
|
|
|
|
(let [app (LwjglApplication. advent cfg)]
|
|
(when (utils/has-saved-settings?)
|
|
(utils/load-settings!))
|
|
(utils/set-fullscreen! (:fullscreen @utils/settings))
|
|
|
|
app))
|
|
|
|
|
|
|
|
(Keyboard/enableRepeatEvents true))
|