mirror of
https://gitlab.com/cc-ru/ocelot/ocelot-desktop.git
synced 2026-01-06 11:12:39 +01:00
Add more graphics debug options
This commit is contained in:
parent
5146a9186e
commit
09454d99ab
@ -22,6 +22,8 @@ class Settings(val config: Config) extends SettingsData {
|
||||
windowPosition = config.getInt2D("ocelot.window.position")
|
||||
windowValidatePosition = config.getBooleanOrElse("ocelot.window.validatePosition", default = true)
|
||||
windowFullscreen = config.getBooleanOrElse("ocelot.window.fullscreen", default = false)
|
||||
disableVsync = config.getBooleanOrElse("ocelot.window.disableVsync", default = false)
|
||||
debugLwjgl = config.getBooleanOrElse("ocelot.window.debugLwjgl", default = false)
|
||||
|
||||
// Windows uses life-hack when it sets position to (-8,-8) for maximized windows to hide the frame.
|
||||
// (https://devblogs.microsoft.com/oldnewthing/20150304-00/?p=44543)
|
||||
@ -135,6 +137,8 @@ object Settings extends Logging {
|
||||
.withValuePreserveOrigin("ocelot.window.validatePosition", settings.windowValidatePosition)
|
||||
.withValue("ocelot.window.size", settings.windowSize)
|
||||
.withValuePreserveOrigin("ocelot.window.fullscreen", settings.windowFullscreen)
|
||||
.withValuePreserveOrigin("ocelot.window.disableVsync", settings.disableVsync)
|
||||
.withValuePreserveOrigin("ocelot.window.debugLwjgl", settings.debugLwjgl)
|
||||
.withValue("ocelot.workspace.recent", settings.recentWorkspace)
|
||||
.withValuePreserveOrigin("ocelot.workspace.stickyWindows", settings.stickyWindows)
|
||||
.withValuePreserveOrigin("ocelot.workspace.saveOnExit", settings.saveOnExit)
|
||||
|
||||
@ -144,14 +144,22 @@ object UiHandler extends Logging {
|
||||
windowTitle = "Ocelot Desktop v" + BuildInfo.version
|
||||
|
||||
loadIcons()
|
||||
Display.setVSyncEnabled(true)
|
||||
|
||||
if (!Settings.get.disableVsync) {
|
||||
logger.info("VSync enabled")
|
||||
Display.setVSyncEnabled(true)
|
||||
} else {
|
||||
logger.info("VSync disabled (via config)")
|
||||
}
|
||||
|
||||
Display.create()
|
||||
KeyEvents.init()
|
||||
MouseEvents.init()
|
||||
|
||||
logger.info(s"Created window with ${root.size}")
|
||||
logger.info(s"Created window: ${Display.getWidth}×${Display.getHeight} (at ${Display.getX}, ${Display.getY})")
|
||||
logger.info(s"OpenGL vendor: ${GL11.glGetString(GL11.GL_VENDOR)}")
|
||||
logger.info(s"OpenGL renderer: ${GL11.glGetString(GL11.GL_RENDERER)}")
|
||||
logger.info(s"OpenGL version: ${GL11.glGetString(GL11.GL_VERSION)}")
|
||||
|
||||
Spritesheet.load()
|
||||
graphics = new Graphics(scalingFactor)
|
||||
@ -210,6 +218,11 @@ object UiHandler extends Logging {
|
||||
}
|
||||
|
||||
System.setProperty("org.lwjgl.librarypath", nativeLibrariesDir)
|
||||
|
||||
if (Settings.get.debugLwjgl) {
|
||||
logger.info("Enabling LWJGL debug mode")
|
||||
System.setProperty("org.lwjgl.util.Debug", true.toString)
|
||||
}
|
||||
}
|
||||
|
||||
private def loadIcons(): Unit = {
|
||||
|
||||
@ -25,6 +25,8 @@ class SettingsData {
|
||||
var windowPosition: Int2D = new Int2D()
|
||||
var windowValidatePosition: Boolean = true
|
||||
var windowFullscreen: Boolean = false
|
||||
var disableVsync: Boolean = false
|
||||
var debugLwjgl: Boolean = false
|
||||
|
||||
var recentWorkspace: Option[String] = None
|
||||
|
||||
@ -32,7 +34,7 @@ class SettingsData {
|
||||
var saveOnExit: Boolean = true
|
||||
var openLastWorkspace: Boolean = true
|
||||
|
||||
private val mirror = scala.reflect.runtime.universe.runtimeMirror(getClass.getClassLoader).reflect(this)
|
||||
private val mirror = ru.runtimeMirror(getClass.getClassLoader).reflect(this)
|
||||
|
||||
def updateWith(data: SettingsData): Unit = {
|
||||
for (fieldSym <- Fields) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user