Added a gui.drawBox() function in the lua engine. Uses four coordinates to draw a box like other emulators rather than a height/width argument.

This commit is contained in:
pasky1382 2012-09-02 01:15:18 +00:00
parent d6f3c05ecd
commit cd292d7fd2
1 changed files with 28 additions and 0 deletions

View File

@ -284,6 +284,7 @@ namespace BizHawk.MultiClient
"cleartext",
"drawPixel",
"drawLine",
"drawBox",
"drawRectangle",
"drawEllipse",
"drawPolygon",
@ -626,6 +627,33 @@ namespace BizHawk.MultiClient
}
}
public void gui_drawBox(object X, object Y, object X2, object Y2, object line, object background = null)
{
using (var g = luaSurface.GetGraphics())
{
try
{
int int_x = LuaInt(X);
int int_y = LuaInt(Y);
int int_width = Math.Abs(LuaInt(X) - LuaInt(X2));
int int_height = Math.Abs(LuaInt(Y) - LuaInt(Y2));
using (var pen = GetPen(line))
{
g.DrawRectangle(pen,int_x,int_y,int_width,int_height);
if (background != null)
using (var brush = GetBrush(background))
g.FillRectangle(brush, int_x, int_y, int_width, int_height);
}
}
catch (Exception)
{
// need to stop the script from here
return;
}
}
}
public void gui_drawPixel(object X, object Y, object color = null)
{
using (var g = luaSurface.GetGraphics())