diff --git a/Johnmagotchi/Core/InputManager/InputManager.cs b/Johnmagotchi/Core/InputManager/InputManager.cs index 8881b48..e1c8302 100644 --- a/Johnmagotchi/Core/InputManager/InputManager.cs +++ b/Johnmagotchi/Core/InputManager/InputManager.cs @@ -1,10 +1,10 @@ -using System; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Input; +using System; using System.Collections.Generic; using System.Diagnostics; using System.Text; - -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Input; +using static System.Windows.Forms.AxHost; namespace TibzGame.Core.Inputs { @@ -34,9 +34,7 @@ namespace TibzGame.Core.Inputs public void getInputs() { handleMouseInput(); - handleKeyboardInput(-1); - } public void ClearAllInputs() { @@ -75,9 +73,12 @@ namespace TibzGame.Core.Inputs // in update function just check bool for pressed state, for example: - // menuInputs.confirm.isPressed + // menuInputs.confirm.isPressed - editorInputs.registerButtons(kbState); + if (!isMouseMode) + { + editorInputs.registerButtons(kbState); + } } @@ -93,7 +94,21 @@ namespace TibzGame.Core.Inputs mouseInput.y = mouseState.Y; mouseInput.scrollWheelValue = mouseState.ScrollWheelValue; - // Debug.WriteLine("MOUSE X: "+ mouseInput.x + " MOUSE Y: " + mouseInput.y); + if (isMouseMode) + { + menuInputs.confirm.RegisterButtonPress(mouseState.LeftButton == ButtonState.Pressed); + menuInputs.cancel.RegisterButtonPress(mouseState.RightButton == ButtonState.Pressed); + editorInputs.confirm.RegisterButtonPress(mouseState.LeftButton == ButtonState.Pressed); + editorInputs.cancel.RegisterButtonPress(mouseState.RightButton == ButtonState.Pressed); + + if (Keyboard.GetState().GetPressedKeys().Length > 0) + { + this.isMouseMode = false; + } + } + + + // Debug.WriteLine("MOUSE X: "+ mouseInput.x + " MOUSE Y: " + mouseInput.y); } } diff --git a/Johnmagotchi/GameContent/Screens/MapScreens/BaseMapScreen.cs b/Johnmagotchi/GameContent/Screens/MapScreens/BaseMapScreen.cs index 9c19171..6ffb7ea 100644 --- a/Johnmagotchi/GameContent/Screens/MapScreens/BaseMapScreen.cs +++ b/Johnmagotchi/GameContent/Screens/MapScreens/BaseMapScreen.cs @@ -231,22 +231,18 @@ namespace Johnmagotchi.Screen.BattleMapScreens } else { - if (screenManager.inputs.editorInputs.confirm.isJustPressed) - { - TibzLog.Debug(" Reverted to keyboard controls"); - screenManager.inputs.isMouseMode = false; - } + UpdateCursorMouse(); - if (screenManager.inputs.mouseInput.leftClick.isJustPressed) - { - screenManager.inputs.editorInputs.confirm.isJustPressed = true; - } - if (screenManager.inputs.mouseInput.rightClick.isJustPressed) - { - screenManager.inputs.editorInputs.cancel.isJustPressed = true; - } + //if (screenManager.inputs.mouseInput.leftClick.isJustPressed) + //{ + // screenManager.inputs.editorInputs.confirm.isJustPressed = true; + //} + //if (screenManager.inputs.mouseInput.rightClick.isJustPressed) + //{ + // screenManager.inputs.editorInputs.cancel.isJustPressed = true; + //} } // update battle map diff --git a/Johnmagotchi/GameContent/Screens/MapScreens/MapEditor/MapEditorScreen.cs b/Johnmagotchi/GameContent/Screens/MapScreens/MapEditor/MapEditorScreen.cs index 18d9a94..cb4401a 100644 --- a/Johnmagotchi/GameContent/Screens/MapScreens/MapEditor/MapEditorScreen.cs +++ b/Johnmagotchi/GameContent/Screens/MapScreens/MapEditor/MapEditorScreen.cs @@ -82,6 +82,8 @@ namespace Johnmagotchi.Screen.BattleMapScreens } if (screenManager.inputs.editorInputs.confirm.isPressed) { + + TibzLog.Debug("Tile confirm pressed" ); CurrentMap.ChangeTileType(this.cursorIndexX, this.cursorIndexY, this.selectedTileType); } }