From 62537118ac2776b992669e0a971e3078cc59ee0a Mon Sep 17 00:00:00 2001 From: YoshiRulz Date: Wed, 17 Jun 2020 10:58:30 +1000 Subject: [PATCH] Add GetPanelNativeSize() to DisplayManager not really that helpful, but removes the annoying dependency on PresentationPanel from IEmuHawkMainForm (ready for move to Client.Common) --- src/BizHawk.Client.EmuHawk/Api/Libraries/EmuClientApi.cs | 4 ++-- src/BizHawk.Client.EmuHawk/DisplayManager/DisplayManager.cs | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/BizHawk.Client.EmuHawk/Api/Libraries/EmuClientApi.cs b/src/BizHawk.Client.EmuHawk/Api/Libraries/EmuClientApi.cs index 3310d72765..984992fa37 100644 --- a/src/BizHawk.Client.EmuHawk/Api/Libraries/EmuClientApi.cs +++ b/src/BizHawk.Client.EmuHawk/Api/Libraries/EmuClientApi.cs @@ -247,7 +247,7 @@ namespace BizHawk.Client.EmuHawk public void SaveState(string name) => _mainForm.SaveState(Path.Combine(_config.PathEntries.SaveStateAbsolutePath(Game.System), $"{name}.State"), name, fromLua: false); - public int ScreenHeight() => _mainForm.PresentationPanel.NativeSize.Height; + public int ScreenHeight() => _displayManager.GetPanelNativeSize().Height; public void Screenshot(string path) { @@ -257,7 +257,7 @@ namespace BizHawk.Client.EmuHawk public void ScreenshotToClipboard() => _mainForm.TakeScreenshotToClipboard(); - public int ScreenWidth() => _mainForm.PresentationPanel.NativeSize.Width; + public int ScreenWidth() => _displayManager.GetPanelNativeSize().Width; public void SeekFrame(int frame) { diff --git a/src/BizHawk.Client.EmuHawk/DisplayManager/DisplayManager.cs b/src/BizHawk.Client.EmuHawk/DisplayManager/DisplayManager.cs index 977e61cdf8..c3c353976d 100644 --- a/src/BizHawk.Client.EmuHawk/DisplayManager/DisplayManager.cs +++ b/src/BizHawk.Client.EmuHawk/DisplayManager/DisplayManager.cs @@ -437,6 +437,8 @@ namespace BizHawk.Client.EmuHawk return new Point((int)v.X, (int)v.Y); } + internal Size GetPanelNativeSize() => presentationPanel.NativeSize; + /// /// This will receive an emulated output frame from an IVideoProvider and run it through the complete frame processing pipeline /// Then it will stuff it into the bound PresentationPanel.