Deprecate `IGuiApi.DrawText` in favour of new method `PixelText`

to match Lua
This commit is contained in:
YoshiRulz 2023-03-10 03:55:05 +10:00
parent 132029d18f
commit 6387291e37
No known key found for this signature in database
GPG Key ID: C4DE31C245353FB7
3 changed files with 22 additions and 1 deletions

View File

@ -544,6 +544,23 @@ namespace BizHawk.Client.Common
}
public void DrawText(int x, int y, string message, Color? forecolor = null, Color? backcolor = null, string fontfamily = null, DisplaySurfaceID? surfaceID = null)
=> PixelText(
x: x,
y: y,
message: message,
forecolor: forecolor,
backcolor: backcolor,
fontfamily: fontfamily,
surfaceID: surfaceID);
public void PixelText(
int x,
int y,
string message,
Color? forecolor = null,
Color? backcolor = null,
string fontfamily = null,
DisplaySurfaceID? surfaceID = null)
{
try
{

View File

@ -56,8 +56,12 @@ namespace BizHawk.Client.Common
void DrawString(int x, int y, string message, Color? forecolor = null, Color? backcolor = null, int? fontsize = null, string fontfamily = null, string fontstyle = null, string horizalign = null, string vertalign = null, DisplaySurfaceID? surfaceID = null);
/// <remarks>exposed to Lua as <c>gui.pixelText</c></remarks>
[Obsolete("method renamed to PixelText to match Lua")]
void DrawText(int x, int y, string message, Color? forecolor = null, Color? backcolor = null, string fontfamily = null, DisplaySurfaceID? surfaceID = null);
/// <remarks>exposed to Lua as <c>gui.pixelText</c></remarks>
void PixelText(int x, int y, string message, Color? forecolor = null, Color? backcolor = null, string fontfamily = null, DisplaySurfaceID? surfaceID = null);
/// <remarks>exposed to Lua as <c>gui.text</c></remarks>
void Text(int x, int y, string message, Color? forecolor = null, string anchor = null);
}

View File

@ -313,7 +313,7 @@ namespace BizHawk.Client.Common
[LuaColorParam] object backcolor = null,
string fontfamily = null,
string surfaceName = null)
=> APIs.Gui.DrawText(x, y, message, _th.SafeParseColor(forecolor), _th.SafeParseColor(backcolor) ?? APIs.Gui.GetDefaultTextBackground().Value, fontfamily, surfaceID: UseOrFallback(surfaceName));
=> APIs.Gui.PixelText(x, y, message, _th.SafeParseColor(forecolor), _th.SafeParseColor(backcolor) ?? APIs.Gui.GetDefaultTextBackground().Value, fontfamily, surfaceID: UseOrFallback(surfaceName));
[LuaMethodExample("gui.text( 16, 32, \"Some message\", 0x7F0000FF, \"bottomleft\" );")]
[LuaMethod("text", "Displays the given text on the screen at the given coordinates. Optional Foreground color. The optional anchor flag anchors the text to one of the four corners. Anchor flag parameters: topleft, topright, bottomleft, bottomright")]