Lua - start gui.text() but currently outputs to console window instead of on screen

This commit is contained in:
andres.delikat 2012-01-28 22:44:48 +00:00
parent c7cc0ee203
commit 064bdbb9a7
1 changed files with 36 additions and 0 deletions

View File

@ -47,6 +47,13 @@ namespace BizHawk.MultiClient
LuaLibraryList += "console." + ConsoleFunctions[i] + "\n";
}
lua.NewTable("gui");
for (int i = 0; i < GuiFunctions.Length; i++)
{
lua.RegisterFunction("gui." + GuiFunctions[i], this, this.GetType().GetMethod("gui_" + GuiFunctions[i]));
LuaLibraryList += "gui." + GuiFunctions[i] + "\n";
}
lua.NewTable("emu");
for (int i = 0; i < EmuFunctions.Length; i++)
{
@ -134,6 +141,11 @@ namespace BizHawk.MultiClient
"getluafunctionslist"
};
public static string[] GuiFunctions = new string[]
{
"text"
};
public static string[] EmuFunctions = new string[]
{
"frameadvance",
@ -236,6 +248,30 @@ namespace BizHawk.MultiClient
return LuaLibraryList;
}
//----------------------------------------------------
//Gui library
//----------------------------------------------------
public void gui_text(object luaX, object luaY, object lua_input)
{
int x = 0;
int y = 0;
try //adelikat: This crap might not be necessary, need to test for a more elegant solution
{
x = int.Parse(luaX.ToString());
y = int.Parse(luaY.ToString());
}
catch
{
return;
}
if (y.GetType() != typeof(int))
return;
Global.MainForm.LuaConsole1.WriteToOutputWindow(lua_input.ToString());
}
//----------------------------------------------------
//Emu library
//----------------------------------------------------