fix #790 (Scroll wheel missing from input.getMouse())

This commit is contained in:
zeromus 2017-02-04 20:52:32 -06:00
parent 0480ea3f44
commit a70e6e2fc4
4 changed files with 10 additions and 1 deletions

View File

@ -2788,6 +2788,11 @@ namespace BizHawk.Client.EmuHawk
AutohideCursor(false);
}
public void MainForm_MouseWheel(object sender, MouseEventArgs e)
{
MouseWheelTracker += e.Delta;
}
public void MainForm_MouseMove(object sender, MouseEventArgs e)
{
AutohideCursor(false);

View File

@ -626,6 +626,8 @@ namespace BizHawk.Client.EmuHawk
public bool TurboFastForward = false;
public bool RestoreReadWriteOnStop = false;
public long MouseWheelTracker;
private int? _pauseOnFrame;
public int? PauseOnFrame // If set, upon completion of this frame, the client wil pause
{

View File

@ -35,6 +35,7 @@ namespace BizHawk.Client.EmuHawk
GraphicsControl.MouseDoubleClick += (o, e) => HandleFullscreenToggle(o, e);
GraphicsControl.MouseClick += (o, e) => GlobalWin.MainForm.MainForm_MouseClick(o, e);
GraphicsControl.MouseMove += (o, e) => GlobalWin.MainForm.MainForm_MouseMove(o, e);
GraphicsControl.MouseWheel += (o, e) => GlobalWin.MainForm.MainForm_MouseWheel(o, e);
}
bool IsDisposed = false;

View File

@ -34,7 +34,7 @@ namespace BizHawk.Client.EmuHawk
[LuaMethodAttributes(
"getmouse",
"Returns a lua table of the mouse X/Y coordinates and button states. Table keys are X, Y, Left, Middle, Right, XButton1, XButton2"
"Returns a lua table of the mouse X/Y coordinates and button states. Table keys are X, Y, Left, Middle, Right, XButton1, XButton2, Wheel."
)]
public LuaTable GetMouse()
{
@ -48,6 +48,7 @@ namespace BizHawk.Client.EmuHawk
buttons[MouseButtons.Right.ToString()] = (Control.MouseButtons & MouseButtons.Right) != 0;
buttons[MouseButtons.XButton1.ToString()] = (Control.MouseButtons & MouseButtons.XButton1) != 0;
buttons[MouseButtons.XButton2.ToString()] = (Control.MouseButtons & MouseButtons.XButton2) != 0;
buttons["Wheel"] = GlobalWin.MainForm.MouseWheelTracker;
return buttons;
}
}