lua - add client.SetClientExtraPadding

This commit is contained in:
zeromus 2015-10-12 20:30:09 -05:00
parent 787cb82e28
commit 21579c1c86
3 changed files with 33 additions and 2 deletions

View File

@ -128,6 +128,11 @@ namespace BizHawk.Client.EmuHawk
/// </summary>
public System.Windows.Forms.Padding GameExtraPadding;
/// <summary>
/// additional pixels added at the native level for the use of lua drawing. essentially just gets tacked onto the final calculated window sizes.
/// </summary>
public System.Windows.Forms.Padding ClientExtraPadding;
TextureFrugalizer VideoTextureFrugalizer;
Dictionary<string, TextureFrugalizer> LuaSurfaceFrugalizers = new Dictionary<string, TextureFrugalizer>();
RenderTargetFrugalizer[] ShaderChainFrugalizers;
@ -498,6 +503,9 @@ namespace BizHawk.Client.EmuHawk
chain_outsize = new Size(bufferWidth * zoom, bufferHeight * zoom);
}
chain_outsize.Width += ClientExtraPadding.Horizontal;
chain_outsize.Height += ClientExtraPadding.Vertical;
var job = new JobInfo
{
videoProvider = fvp,
@ -609,6 +617,7 @@ namespace BizHawk.Client.EmuHawk
fPresent.GuiRenderer = Renderer;
fPresent.Config_FixAspectRatio = Global.Config.DispFixAspectRatio;
fPresent.Config_FixScaleInteger = Global.Config.DispFixScaleInteger;
fPresent.Padding = ClientExtraPadding;
fPresent.GL = GL;

View File

@ -222,7 +222,11 @@ namespace BizHawk.Client.EmuHawk.Filters
LL.vh = size.Height;
}
else
{
LL = new LetterboxingLogic(Config_FixAspectRatio, Config_FixScaleInteger, OutputSize.Width, OutputSize.Height, size.Width, size.Height, TextureSize, VirtualTextureSize);
LL.vx += Padding.Left;
LL.vy += Padding.Top;
}
return size;
}
@ -254,8 +258,16 @@ namespace BizHawk.Client.EmuHawk.Filters
LL.vw = InputSize.Width;
LL.vh = InputSize.Height;
}
else
LL = new LetterboxingLogic(Config_FixAspectRatio, Config_FixScaleInteger, OutputSize.Width, OutputSize.Height, InputSize.Width, InputSize.Height, TextureSize, VirtualTextureSize);
else
{
int ow = OutputSize.Width;
int oh = OutputSize.Height;
ow -= Padding.Horizontal;
oh -= Padding.Vertical;
LL = new LetterboxingLogic(Config_FixAspectRatio, Config_FixScaleInteger, ow, oh, InputSize.Width, InputSize.Height, TextureSize, VirtualTextureSize);
LL.vx += Padding.Left;
LL.vy += Padding.Top;
}
ContentSize = new Size(LL.vw,LL.vh);
}

View File

@ -161,6 +161,16 @@ namespace BizHawk.Client.EmuHawk
GlobalWin.MainForm.FrameBufferResized();
}
[LuaMethodAttributes(
"SetClientExtraPadding",
"Sets the extra padding added to the 'native' surface so that you can draw HUD elements in predictable placements"
)]
public static void SetClientExtraPadding(int left, int top, int right, int bottom)
{
GlobalWin.DisplayManager.ClientExtraPadding = new System.Windows.Forms.Padding(left, top, right, bottom);
GlobalWin.MainForm.FrameBufferResized();
}
[LuaMethodAttributes(
"ispaused",
"Returns true if emulator is paused, otherwise, false"