lua: add gui.DrawFinish() which will let you choose when to finish drawing; and add optional argument to gui.DrawNew which when set to false lets you keep it from being cleared.
This commit is contained in:
parent
c069f8fe5c
commit
676b5791f6
|
@ -869,7 +869,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Locks the requested lua surface name
|
/// Locks the requested lua surface name
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public DisplaySurface LockLuaSurface(string name)
|
public DisplaySurface LockLuaSurface(string name, bool clear=true)
|
||||||
{
|
{
|
||||||
if (MapNameToLuaSurface.ContainsKey(name))
|
if (MapNameToLuaSurface.ContainsKey(name))
|
||||||
throw new InvalidOperationException("Lua surface is already locked: " + name);
|
throw new InvalidOperationException("Lua surface is already locked: " + name);
|
||||||
|
@ -898,7 +898,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
else if(name == "native") { width = currNativeWidth; height = currNativeHeight; }
|
else if(name == "native") { width = currNativeWidth; height = currNativeHeight; }
|
||||||
else throw new InvalidOperationException("Unknown lua surface name: " +name);
|
else throw new InvalidOperationException("Unknown lua surface name: " +name);
|
||||||
|
|
||||||
DisplaySurface ret = sdss.AllocateSurface(width, height);
|
DisplaySurface ret = sdss.AllocateSurface(width, height, clear);
|
||||||
MapNameToLuaSurface[name] = ret;
|
MapNameToLuaSurface[name] = ret;
|
||||||
MapLuaSurfaceToName[ret] = name;
|
MapLuaSurfaceToName[ret] = name;
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -913,8 +913,9 @@ namespace BizHawk.Client.EmuHawk
|
||||||
var surf = PeekLockedLuaSurface(kvp.Key);
|
var surf = PeekLockedLuaSurface(kvp.Key);
|
||||||
DisplaySurface surfLocked = null;
|
DisplaySurface surfLocked = null;
|
||||||
if (surf == null)
|
if (surf == null)
|
||||||
surf = surfLocked = LockLuaSurface(kvp.Key);
|
surf = surfLocked = LockLuaSurface(kvp.Key,true);
|
||||||
surf.Clear();
|
//zero 21-apr-2016 - we shouldnt need this
|
||||||
|
//surf.Clear();
|
||||||
if (surfLocked != null)
|
if (surfLocked != null)
|
||||||
UnlockLuaSurface(surfLocked);
|
UnlockLuaSurface(surfLocked);
|
||||||
LuaSurfaceSets[kvp.Key].SetPending(null);
|
LuaSurfaceSets[kvp.Key].SetPending(null);
|
||||||
|
|
|
@ -54,14 +54,14 @@ namespace BizHawk.Client.EmuHawk
|
||||||
|
|
||||||
[LuaMethodAttributes(
|
[LuaMethodAttributes(
|
||||||
"DrawNew",
|
"DrawNew",
|
||||||
"Changes drawing target to the specified lua surface name. This may clobber any previous drawing to this surface."
|
"Changes drawing target to the specified lua surface name. This may clobber any previous drawing to this surface (pass false if you don't want it to)"
|
||||||
)]
|
)]
|
||||||
public void DrawNew(string name)
|
public void DrawNew(string name, bool? clear=true)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
DrawFinish();
|
DrawFinish();
|
||||||
_luaSurface = GlobalWin.DisplayManager.LockLuaSurface(name);
|
_luaSurface = GlobalWin.DisplayManager.LockLuaSurface(name,clear??true);
|
||||||
}
|
}
|
||||||
catch (InvalidOperationException ex)
|
catch (InvalidOperationException ex)
|
||||||
{
|
{
|
||||||
|
@ -69,6 +69,10 @@ namespace BizHawk.Client.EmuHawk
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[LuaMethodAttributes(
|
||||||
|
"DrawFinish",
|
||||||
|
"Finishes drawing to the current lua surface and causes it to get displayed."
|
||||||
|
)]
|
||||||
public void DrawFinish()
|
public void DrawFinish()
|
||||||
{
|
{
|
||||||
if(_luaSurface != null)
|
if(_luaSurface != null)
|
||||||
|
|
Loading…
Reference in New Issue