From ac47a4db83a4581728da989a8947b5a88001e7c8 Mon Sep 17 00:00:00 2001 From: austin Date: Wed, 30 Apr 2025 13:18:54 -0400 Subject: [PATCH] toggle mouse release control --- docs/src/progress/renderertodo.md | 1 + .../client/interact/select/AreaSelection.java | 21 ------------------- .../categories/ControlCategoryMainGame.java | 15 +++++++++++++ 3 files changed, 16 insertions(+), 21 deletions(-) diff --git a/docs/src/progress/renderertodo.md b/docs/src/progress/renderertodo.md index a46e2c13..ab673294 100644 --- a/docs/src/progress/renderertodo.md +++ b/docs/src/progress/renderertodo.md @@ -1612,6 +1612,7 @@ Voxel placement improvements Smaller wall section First proper house~! Rect area selection expands each axis independently +Control to toggle mouse release (ie for eventual on-screen controls) diff --git a/src/main/java/electrosphere/client/interact/select/AreaSelection.java b/src/main/java/electrosphere/client/interact/select/AreaSelection.java index 15fb68fa..da272b16 100644 --- a/src/main/java/electrosphere/client/interact/select/AreaSelection.java +++ b/src/main/java/electrosphere/client/interact/select/AreaSelection.java @@ -324,27 +324,6 @@ public class AreaSelection { } } - //loops only break on the iteration where we encounter a barrier, so need to roll the radius values back by 1 - //in order to not include the blocks that caused the break itself - // if(endOffset.x > 1){ - // endOffset.x--; - // } - // if(endOffset.y > 1){ - // endOffset.y--; - // } - // if(endOffset.z > 1){ - // endOffset.z--; - // } - // if(startOffset.x < 0){ - // startOffset.x++; - // } - // if(startOffset.y < 0){ - // startOffset.y++; - // } - // if(startOffset.z < 0){ - // startOffset.z++; - // } - Vector3d startPos = new Vector3d(Globals.clientWorldData.convertBlockToRealSpace(chunkPos, blockPos)) .add( startOffset.x * BlockChunkData.BLOCK_SIZE_MULTIPLIER, diff --git a/src/main/java/electrosphere/controls/categories/ControlCategoryMainGame.java b/src/main/java/electrosphere/controls/categories/ControlCategoryMainGame.java index 05e19fd4..2d523a7b 100644 --- a/src/main/java/electrosphere/controls/categories/ControlCategoryMainGame.java +++ b/src/main/java/electrosphere/controls/categories/ControlCategoryMainGame.java @@ -76,6 +76,7 @@ public class ControlCategoryMainGame { public static final String ITEM_SECONDARY = "actionItemSecondary"; public static final String TOOLBAR_SCROLL = "toolbarScroll"; public static final String OPEN_CRAFTING = "openCrafting"; + public static final String TOGGLE_RELEASE_MOUSE = "toggleReleaseMouse"; /** * Maps the controls @@ -103,6 +104,7 @@ public class ControlCategoryMainGame { handler.addControl(ITEM_SECONDARY, new Control(ControlType.MOUSE_BUTTON,GLFW.GLFW_MOUSE_BUTTON_RIGHT,false,"Secondary","Uses the secondary equipped item")); handler.addControl(TOOLBAR_SCROLL, new Control(ControlType.MOUSE_SCROLL,0,false,"","")); handler.addControl(OPEN_CRAFTING, new Control(ControlType.KEY,GLFW.GLFW_KEY_C,true,"Open Crafting Menu", "Opens the crafting menu")); + handler.addControl(TOGGLE_RELEASE_MOUSE, new Control(ControlType.KEY,GLFW.GLFW_KEY_LEFT_ALT,true,"Toggle Mouse", "Toggles whether the mouse is visible or not")); } /** @@ -783,6 +785,19 @@ public class ControlCategoryMainGame { WindowUtils.openInteractionMenu(WindowStrings.CRAFTING, CraftingWindow.HAND_CRAFTING_DATA); }}); controlMap.get(OPEN_CRAFTING).setRepeatTimeout(0.5f * Main.targetFrameRate); + + /* + Open crafting + */ + mainGameControlList.add(controlMap.get(TOGGLE_RELEASE_MOUSE)); + controlMap.get(TOGGLE_RELEASE_MOUSE).setOnClick(new ControlMethod(){public void execute(MouseState mouseState){ + if(Globals.controlHandler.isMouseVisible()){ + Globals.controlHandler.hideMouse(); + } else { + Globals.controlHandler.showMouse(); + } + }}); + controlMap.get(TOGGLE_RELEASE_MOUSE).setRepeatTimeout(0.5f * Main.targetFrameRate); } }