Merge MouseWheelTracker from MainForm interface into InputManager

This commit is contained in:
YoshiRulz 2020-12-03 18:35:24 +10:00
parent f6d465a1ac
commit 29bceb272f
No known key found for this signature in database
GPG Key ID: C4DE31C245353FB7
4 changed files with 6 additions and 11 deletions

View File

@ -9,13 +9,10 @@ namespace BizHawk.Client.Common
private readonly InputManager _inputManager;
private readonly IMainFormForApi _mainForm;
public InputApi(IMainFormForApi mainForm, IWindowCoordsTransformer displayManager, InputManager inputManager)
public InputApi(IWindowCoordsTransformer displayManager, InputManager inputManager)
{
_displayManager = displayManager;
_inputManager = inputManager;
_mainForm = mainForm;
}
public Dictionary<string, bool> Get()
@ -27,7 +24,7 @@ namespace BizHawk.Client.Common
public Dictionary<string, object> GetMouse()
{
var (pos, lmb, mmb, rmb, x1mb, x2mb) = _inputManager.GetMainFormMouseInfo();
var (pos, scroll, lmb, mmb, rmb, x1mb, x2mb) = _inputManager.GetMainFormMouseInfo();
// TODO - need to specify whether in "emu" or "native" coordinate space.
var p = _displayManager.UntransformPoint(pos);
return new Dictionary<string, object>
@ -39,7 +36,7 @@ namespace BizHawk.Client.Common
["Right"] = rmb,
["XButton1"] = x1mb,
["XButton2"] = x2mb,
["Wheel"] = _mainForm.MouseWheelTracker
["Wheel"] = scroll
};
}
}

View File

@ -26,9 +26,6 @@ namespace BizHawk.Client.Common
/// <remarks>only referenced from <c>EmuClientApi</c></remarks>
bool IsTurboing { get; }
/// <remarks>only referenced from <c>InputApi</c></remarks>
long MouseWheelTracker { get; }
/// <remarks>only referenced from <see cref="CommApi"/></remarks>
(HttpCommunication HTTP, MemoryMappedFiles MMF, SocketServer Sockets) NetworkingHelpers { get; }

View File

@ -47,7 +47,7 @@ namespace BizHawk.Client.Common
public Controller ClientControls { get; set; }
public Func<(Point Pos, bool LMB, bool MMB, bool RMB, bool X1MB, bool X2MB)> GetMainFormMouseInfo { get; set; }
public Func<(Point Pos, long Scroll, bool LMB, bool MMB, bool RMB, bool X1MB, bool X2MB)> GetMainFormMouseInfo { get; set; }
public void SyncControls(IEmulator emulator, IMovieSession session, Config config)
{

View File

@ -290,6 +290,7 @@ namespace BizHawk.Client.EmuHawk
var b = Control.MouseButtons;
return (
Control.MousePosition,
MouseWheelTracker,
(b & MouseButtons.Left) != 0,
(b & MouseButtons.Middle) != 0,
(b & MouseButtons.Right) != 0,
@ -799,7 +800,7 @@ namespace BizHawk.Client.EmuHawk
/// </summary>
public bool InvisibleEmulation { get; set; }
public long MouseWheelTracker { get; private set; }
private long MouseWheelTracker;
private int? _pauseOnFrame;
public int? PauseOnFrame // If set, upon completion of this frame, the client wil pause