Rename new Lua function by convention, fix ClientApi.TransformPoint

I doubt this ever worked. The Lua one wasn't delegated, it directly accessed
GlobalWin, so it didn't have this bug.
This commit is contained in:
YoshiRulz 2020-04-01 12:46:56 +10:00
parent 00471ac530
commit 6571f70283
No known key found for this signature in database
GPG Key ID: C4DE31C245353FB7
2 changed files with 8 additions and 8 deletions

View File

@ -666,12 +666,12 @@ namespace BizHawk.Client.ApiHawk
public static Point TransformPoint(Point point)
{
Type t = ClientAssembly.GetType("BizHawk.Client.EmuHawk.GlobalWin");
FieldInfo f = t.GetField("DisplayManager");
object displayManager = f.GetValue(null);
MethodInfo m = t.GetMethod("TransFormPoint");
point = (System.Drawing.Point)m.Invoke(displayManager, new object[] { point });
return point;
var globalWinType = ClientAssembly.GetType("BizHawk.Client.EmuHawk.GlobalWin");
var dispManType = ClientAssembly.GetType("BizHawk.Client.EmuHawk.DisplayManager");
var dispManInstance = globalWinType.GetField("DisplayManager").GetValue(null);
var transformed = dispManType.GetMethod("TransformPoint")?.Invoke(dispManInstance, new object[] { point });
if (transformed is Point p) return p;
throw new Exception();
}
[Obsolete]

View File

@ -362,8 +362,8 @@ namespace BizHawk.Client.EmuHawk
MainForm.TogglePause();
}
[LuaMethodExample("local newPoint = client.transformPoint( 32, 100 );")]
[LuaMethod("transformPoint", "Transforms a point in emulator space to a point in client space")]
[LuaMethodExample("local newY = client.transform_point( 32, 100 ).y;")]
[LuaMethod("transform_point", "Transforms a point (x, y) in emulator space to a point in client space")]
public LuaTable TransformPoint(int x, int y) {
var transformed = ClientApi.TransformPoint(new Point(x, y));
var table = Lua.NewTable();