Added run argument to disable cursor catching for debug ease

This commit is contained in:
Quique 2021-12-11 14:58:53 +01:00 committed by Bixilon
parent ec37f31e15
commit 802aa5cb53
4 changed files with 11 additions and 5 deletions

View File

@ -17,6 +17,7 @@ import de.bixilon.minosoft.config.StaticConfiguration
import de.bixilon.minosoft.config.profile.delegate.watcher.SimpleProfileDelegateWatcher.Companion.profileWatchRendering import de.bixilon.minosoft.config.profile.delegate.watcher.SimpleProfileDelegateWatcher.Companion.profileWatchRendering
import de.bixilon.minosoft.config.profile.profiles.rendering.RenderingProfile import de.bixilon.minosoft.config.profile.profiles.rendering.RenderingProfile
import de.bixilon.minosoft.data.assets.AssetsManager import de.bixilon.minosoft.data.assets.AssetsManager
import de.bixilon.minosoft.terminal.RunConfiguration
import de.bixilon.minosoft.util.KUtil.toResourceLocation import de.bixilon.minosoft.util.KUtil.toResourceLocation
import de.matthiasmann.twl.utils.PNGDecoder import de.matthiasmann.twl.utils.PNGDecoder
import glm_.vec2.Vec2 import glm_.vec2.Vec2
@ -49,7 +50,7 @@ interface BaseWindow {
resizable = true resizable = true
profile.advanced::swapInterval.profileWatchRendering(this, true, profile) { swapInterval = it } profile.advanced::swapInterval.profileWatchRendering(this, true, profile) { swapInterval = it }
if (!StaticConfiguration.DEBUG_MODE) { if (!RunConfiguration.DISABLE_CURSOR_CATCH) {
cursorMode = CursorModes.DISABLED cursorMode = CursorModes.DISABLED
} }
size = DEFAULT_WINDOW_SIZE size = DEFAULT_WINDOW_SIZE

View File

@ -29,6 +29,7 @@ import de.bixilon.minosoft.gui.rendering.system.window.BaseWindow.Companion.DEFA
import de.bixilon.minosoft.gui.rendering.system.window.BaseWindow.Companion.DEFAULT_WINDOW_SIZE import de.bixilon.minosoft.gui.rendering.system.window.BaseWindow.Companion.DEFAULT_WINDOW_SIZE
import de.bixilon.minosoft.gui.rendering.util.vec.vec2.Vec2dUtil.EMPTY import de.bixilon.minosoft.gui.rendering.util.vec.vec2.Vec2dUtil.EMPTY
import de.bixilon.minosoft.modding.event.master.AbstractEventMaster import de.bixilon.minosoft.modding.event.master.AbstractEventMaster
import de.bixilon.minosoft.terminal.RunConfiguration
import de.bixilon.minosoft.util.OSUtil import de.bixilon.minosoft.util.OSUtil
import de.bixilon.minosoft.util.logging.Log import de.bixilon.minosoft.util.logging.Log
import de.bixilon.minosoft.util.logging.LogLevels import de.bixilon.minosoft.util.logging.LogLevels
@ -163,7 +164,6 @@ class GLFWWindow(
} }
} }
glfwSetKeyCallback(window, this::keyInput) glfwSetKeyCallback(window, this::keyInput)
glfwSetMouseButtonCallback(window, this::mouseKeyInput) glfwSetMouseButtonCallback(window, this::mouseKeyInput)
@ -282,11 +282,12 @@ class GLFWWindow(
if (windowId != window) { if (windowId != window) {
return return
} }
val position = Vec2d(x, y) val position = Vec2d(x, y)
val previous = this.mousePosition val previous = this.mousePosition
val delta = position - previous val delta = position - previous
this.mousePosition = position this.mousePosition = position
if (!skipNextMouseEvent) { if (!skipNextMouseEvent) {
eventMaster.fireEvent(MouseMoveEvent(position = position, previous = previous, delta = delta)) eventMaster.fireEvent(MouseMoveEvent(position = position, previous = previous, delta = delta))
} else { } else {

View File

@ -50,6 +50,10 @@ object CommandLineArguments {
.action(Arguments.storeTrue()) .action(Arguments.storeTrue())
.help("Disables rendering") .help("Disables rendering")
addArgument("--disable_cursor_catch")
.action(Arguments.storeTrue())
.help("Disables catching the cursor")
addArgument("--headless") addArgument("--headless")
.action(Arguments.storeTrue()) .action(Arguments.storeTrue())
.help("Disables the server list and rendering") .help("Disables the server list and rendering")
@ -88,7 +92,7 @@ object CommandLineArguments {
RunConfiguration.LOG_COLOR_LEVEL = namespace.getBoolean("disable_log_color_level") RunConfiguration.LOG_COLOR_LEVEL = namespace.getBoolean("disable_log_color_level")
RunConfiguration.LOG_COLOR_TYPE = namespace.getBoolean("disable_log_color_type") RunConfiguration.LOG_COLOR_TYPE = namespace.getBoolean("disable_log_color_type")
RunConfiguration.LOG_RELATIVE_TIME = namespace.getBoolean("relative_log") RunConfiguration.LOG_RELATIVE_TIME = namespace.getBoolean("relative_log")
RunConfiguration.DISABLE_CURSOR_CATCH = namespace.getBoolean("disable_cursor_catch")
RunConfiguration.DISABLE_EROS = namespace.getBoolean("disable_eros") RunConfiguration.DISABLE_EROS = namespace.getBoolean("disable_eros")
RunConfiguration.DISABLE_RENDERING = namespace.getBoolean("disable_rendering") RunConfiguration.DISABLE_RENDERING = namespace.getBoolean("disable_rendering")

View File

@ -33,7 +33,7 @@ object RunConfiguration {
var DISABLE_EROS = false // if true, the whole javafx eros part is disabled var DISABLE_EROS = false // if true, the whole javafx eros part is disabled
var DISABLE_RENDERING = false // if true, rendering is disabled var DISABLE_RENDERING = false // if true, rendering is disabled
var DISABLE_CURSOR_CATCH = false
var PROFILES_HOT_RELOADING = true var PROFILES_HOT_RELOADING = true
var AUTO_CONNECT_TO: String? = null var AUTO_CONNECT_TO: String? = null