Merge branch 'fix-mouse-lock' into 'master'

Added run argument to disable cursor catching for debug ease

See merge request bixilon/minosoft!33
This commit is contained in:
Bixilon 2021-12-11 14:58:53 +01:00
commit 674c535605
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.profiles.rendering.RenderingProfile
import de.bixilon.minosoft.data.assets.AssetsManager
import de.bixilon.minosoft.terminal.RunConfiguration
import de.bixilon.minosoft.util.KUtil.toResourceLocation
import de.matthiasmann.twl.utils.PNGDecoder
import glm_.vec2.Vec2
@ -49,7 +50,7 @@ interface BaseWindow {
resizable = true
profile.advanced::swapInterval.profileWatchRendering(this, true, profile) { swapInterval = it }
if (!StaticConfiguration.DEBUG_MODE) {
if (!RunConfiguration.DISABLE_CURSOR_CATCH) {
cursorMode = CursorModes.DISABLED
}
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.util.vec.vec2.Vec2dUtil.EMPTY
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.logging.Log
import de.bixilon.minosoft.util.logging.LogLevels
@ -163,7 +164,6 @@ class GLFWWindow(
}
}
glfwSetKeyCallback(window, this::keyInput)
glfwSetMouseButtonCallback(window, this::mouseKeyInput)
@ -282,11 +282,12 @@ class GLFWWindow(
if (windowId != window) {
return
}
val position = Vec2d(x, y)
val previous = this.mousePosition
val delta = position - previous
this.mousePosition = position
if (!skipNextMouseEvent) {
eventMaster.fireEvent(MouseMoveEvent(position = position, previous = previous, delta = delta))
} else {

View File

@ -50,6 +50,10 @@ object CommandLineArguments {
.action(Arguments.storeTrue())
.help("Disables rendering")
addArgument("--disable_cursor_catch")
.action(Arguments.storeTrue())
.help("Disables catching the cursor")
addArgument("--headless")
.action(Arguments.storeTrue())
.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_TYPE = namespace.getBoolean("disable_log_color_type")
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_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_RENDERING = false // if true, rendering is disabled
var DISABLE_CURSOR_CATCH = false
var PROFILES_HOT_RELOADING = true
var AUTO_CONNECT_TO: String? = null