gui.drawImage implemented. It needs a Path, X and Y Points, Width (optional) and Height (optional). If Width or Height are null, their value will change to the original Width/Height. As with gui.drawIcon, the Path needs double backslash (\\).
Take in mind that if the image have transparent background, the background will be drawn in transparent.
This commit is contained in:
parent
fd9005f361
commit
56b8d6d55e
|
@ -261,6 +261,7 @@ namespace BizHawk.MultiClient
|
|||
"drawBezier",
|
||||
"drawPie",
|
||||
"drawIcon",
|
||||
"drawImage",
|
||||
};
|
||||
|
||||
public static string[] EmuFunctions = new string[]
|
||||
|
@ -675,6 +676,28 @@ namespace BizHawk.MultiClient
|
|||
}
|
||||
}
|
||||
|
||||
public void gui_drawImage(object Path, object x, object y, object width = null, object height = null)
|
||||
{
|
||||
using (var g = luaSurface.GetGraphics())
|
||||
{
|
||||
try
|
||||
{
|
||||
Image img = Image.FromFile(Path.ToString());
|
||||
|
||||
if (width == null || width.GetType() != typeof(int))
|
||||
width = img.Width.ToString();
|
||||
if (height == null || height.GetType() != typeof(int))
|
||||
height = img.Height.ToString();
|
||||
|
||||
g.DrawImage(img, LuaInt(x), LuaInt(y), int.Parse(width.ToString()), int.Parse(height.ToString()));
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//----------------------------------------------------
|
||||
//Emu library
|
||||
//----------------------------------------------------
|
||||
|
|
Loading…
Reference in New Issue