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.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() {
@ -77,7 +75,10 @@ namespace TibzGame.Core.Inputs
// in update function just check bool for pressed state, for example:
// menuInputs.confirm.isPressed
if (!isMouseMode)
{
editorInputs.registerButtons(kbState);
}
}
@ -93,6 +94,20 @@ namespace TibzGame.Core.Inputs
mouseInput.y = mouseState.Y;
mouseInput.scrollWheelValue = mouseState.ScrollWheelValue;
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 {
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

View File

@ -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);
}
}