LuaCanvas: Include GetMouseX & Y functions

Gets the X and Y coordinates for the mouse cursor relative to the canvas
This commit is contained in:
Trivial-Man 2017-06-29 20:07:21 -06:00 committed by GitHub
parent 1a1ae98a2e
commit 22200171e7
1 changed files with 20 additions and 0 deletions

View File

@ -295,5 +295,25 @@ namespace BizHawk.Client.EmuHawk
{
luaPictureBox.DrawText(x, y, message, forecolor, backcolor, fontsize, fontfamily, fontstyle, horizalign, vertalign);
}
// It'd be great if these were simplified into 1 function, but I cannot figure out how to return a LuaTable from this class
[LuaMethodAttributes(
"GetMouseX",
"Returns an integer representation of the mouse X coordinate relative to the canvas window.")]
public int GetMouseX()
{
var position = luaPictureBox.GetMouse();
return position.X;
}
[LuaMethodAttributes(
"GetMouseY",
"Returns an integer representation of the mouse Y coordinate relative to the canvas window.")]
public int GetMouseY()
{
var position = luaPictureBox.GetMouse();
return position.Y;
}
}
}