changed mouse support to be slightly less bad

This commit is contained in:
tibz 2026-09-28 23:52:31 -05:00
parent e54ba4652f
commit 0ff38087b1
3 changed files with 35 additions and 22 deletions

View File

@ -1,10 +1,10 @@
using System; using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Input;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Diagnostics; using System.Diagnostics;
using System.Text; using System.Text;
using static System.Windows.Forms.AxHost;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Input;
namespace TibzGame.Core.Inputs namespace TibzGame.Core.Inputs
{ {
@ -34,9 +34,7 @@ namespace TibzGame.Core.Inputs
public void getInputs() { public void getInputs() {
handleMouseInput(); handleMouseInput();
handleKeyboardInput(-1); handleKeyboardInput(-1);
} }
public void ClearAllInputs() { public void ClearAllInputs() {
@ -75,9 +73,12 @@ namespace TibzGame.Core.Inputs
// in update function just check bool for pressed state, for example: // 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.y = mouseState.Y;
mouseInput.scrollWheelValue = mouseState.ScrollWheelValue; 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);
} }
} }

View File

@ -231,22 +231,18 @@ namespace Johnmagotchi.Screen.BattleMapScreens
} }
else { else {
if (screenManager.inputs.editorInputs.confirm.isJustPressed)
{
TibzLog.Debug(" Reverted to keyboard controls");
screenManager.inputs.isMouseMode = false;
}
UpdateCursorMouse(); UpdateCursorMouse();
if (screenManager.inputs.mouseInput.leftClick.isJustPressed) //if (screenManager.inputs.mouseInput.leftClick.isJustPressed)
{ //{
screenManager.inputs.editorInputs.confirm.isJustPressed = true; // screenManager.inputs.editorInputs.confirm.isJustPressed = true;
} //}
if (screenManager.inputs.mouseInput.rightClick.isJustPressed) //if (screenManager.inputs.mouseInput.rightClick.isJustPressed)
{ //{
screenManager.inputs.editorInputs.cancel.isJustPressed = true; // screenManager.inputs.editorInputs.cancel.isJustPressed = true;
} //}
} }
// update battle map // update battle map

View File

@ -82,6 +82,8 @@ namespace Johnmagotchi.Screen.BattleMapScreens
} }
if (screenManager.inputs.editorInputs.confirm.isPressed) if (screenManager.inputs.editorInputs.confirm.isPressed)
{ {
TibzLog.Debug("Tile confirm pressed" );
CurrentMap.ChangeTileType(this.cursorIndexX, this.cursorIndexY, this.selectedTileType); CurrentMap.ChangeTileType(this.cursorIndexX, this.cursorIndexY, this.selectedTileType);
} }
} }