From f5a7dc2191b2a1f7a174651c2b6332e0fe0c4fd9 Mon Sep 17 00:00:00 2001 From: "andres.delikat" Date: Thu, 12 Jul 2012 22:20:48 +0000 Subject: [PATCH] Lua - implement client.setwindowsize() --- BizHawk.MultiClient/LuaImplementation.cs | 25 ++++++++++++++++++++++++ BizHawk.MultiClient/MainForm.cs | 2 +- 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/BizHawk.MultiClient/LuaImplementation.cs b/BizHawk.MultiClient/LuaImplementation.cs index 6891348160..b0c196e5b9 100644 --- a/BizHawk.MultiClient/LuaImplementation.cs +++ b/BizHawk.MultiClient/LuaImplementation.cs @@ -401,6 +401,7 @@ namespace BizHawk.MultiClient }; public static string[] MultiClientFunctions = new string[] { + "setwindowsize", "openrom", "closerom", "opentoolbox", @@ -1765,6 +1766,30 @@ namespace BizHawk.MultiClient Global.MainForm.LoadTAStudio(); } + public void client_setwindowsize(object window_size) + { + try + { + string temp = window_size.ToString(); + int size = Convert.ToInt32(temp); + if (size == 1 || size == 2 || size == 3 || size == 4 || size == 5 || size == 10) + { + Global.Config.TargetZoomFactor = size; + Global.MainForm.FrameBufferResized(); + Global.OSD.AddMessage("Window size set to " + size.ToString() + "x"); + } + else + { + console_log("Invalid window size"); + } + } + catch + { + console_log("Invalid window size"); + } + + } + public void client_opencheats() { Global.MainForm.LoadCheatsWindow(); diff --git a/BizHawk.MultiClient/MainForm.cs b/BizHawk.MultiClient/MainForm.cs index d79a98140c..717c902729 100644 --- a/BizHawk.MultiClient/MainForm.cs +++ b/BizHawk.MultiClient/MainForm.cs @@ -2372,7 +2372,7 @@ namespace BizHawk.MultiClient Global.DisplayManager.UpdateSource(Global.Emulator.VideoProvider); } - private void FrameBufferResized() + public void FrameBufferResized() { var video = Global.Emulator.VideoProvider; int zoom = Global.Config.TargetZoomFactor;