Files
tickstales/desktop/src/advent/core/desktop_launcher.clj
Bryce Covert 8ee743e371 fixes.
2021-09-08 08:00:59 -07:00

63 lines
2.1 KiB
Clojure

(ns advent.core.desktop-launcher
(:require [advent.core :refer :all]
[advent.utils :as utils]
[play-clj.core :refer :all]
[clojure.tools.logging :as log])
(:import [com.badlogic.gdx.backends.lwjgl3 Lwjgl3Application Lwjgl3ApplicationConfiguration Lwjgl3ApplicationConfiguration$HdpiMode]
#_[org.lwjgl.input Keyboard]
[com.badlogic.gdx Gdx Files$FileType]
[com.badlogic.gdx.graphics.glutils ])
(:gen-class))
(def has-nrepl?
(try
(require '[play-clj-nrepl.core :as a])
(System/getProperty "use-repl")
(catch Exception e
false)))
(defn -main
[& [port]]
(when has-nrepl?
(eval `(play-clj-nrepl.core/start-nrepl advent.core/advent ~port)))
(let [cfg (Lwjgl3ApplicationConfiguration.)]
#_(.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)
#_(set! (.title cfg) "Tick's Tales: Up All Knight")
(doto cfg
#_(.setBackgroundFPS 60)
#_(.setForegroundFPS 60)
(.setHdpiMode Lwjgl3ApplicationConfiguration$HdpiMode/Pixels)
(.setTitle "Tick's Tales: Up All Knight")
(.setWindowIcon (into-array ["icon/icon_128x128.png"
"icon/icon_32x32.png"
"icon/icon_16x16.png"]))
(.setWindowedMode (* 640 2) (* 480 2)))
#_(set! (.foregroundFPS cfg) 60)
#_(set! (.backgroundFPS cfg) 60)
#_(set! (.windowWidth cfg) (* 640 2))
#_(set! (.windowHeight cfg) (* 480 2))
(System/setProperty "org.lwjgl.opengl.Display.enableHighDPI" "false")
(System/setProperty "org.lwjgl.opengl.Display.disableOSXFullscreenModeAPI" "true")
#_(System/setProperty "org.lwjgl.opengl.Window.undecorated", "true")
(log/info "Starting game")
(let [app (Lwjgl3Application. advent cfg)]
(when (utils/has-saved-settings?)
(utils/load-settings!))
(utils/set-fullscreen! (:fullscreen @utils/settings))
app))
#_(Keyboard/enableRepeatEvents true))