Move prop GlobalWin.OSD to global DisplayManager

This commit is contained in:
YoshiRulz 2020-11-28 22:24:01 +10:00
parent b0b2b8fa63
commit 56df80bb5a
No known key found for this signature in database
GPG Key ID: C4DE31C245353FB7
6 changed files with 17 additions and 18 deletions

View File

@ -104,7 +104,7 @@ namespace BizHawk.Client.EmuHawk
public (int Left, int Top, int Right, int Bottom) GetPadding() => (_padding.Left, _padding.Top, _padding.Right, _padding.Bottom);
public void AddMessage(string message) => GlobalWin.OSD.AddMessage(message);
public void AddMessage(string message) => _displayManager.OSD.AddMessage(message);
public void ClearGraphics()
{
@ -112,7 +112,7 @@ namespace BizHawk.Client.EmuHawk
DrawFinish();
}
public void ClearText() => GlobalWin.OSD.ClearGuiText();
public void ClearText() => _displayManager.OSD.ClearGuiText();
public void SetDefaultForegroundColor(Color color) => _defaultForeground = color;
@ -525,7 +525,7 @@ namespace BizHawk.Client.EmuHawk
}
var pos = new MessagePosition{ X = x, Y = y, Anchor = (MessagePosition.AnchorType)a };
GlobalWin.OSD.AddGuiText(message, pos, Color.Black, forecolor ?? Color.White);
_displayManager.OSD.AddGuiText(message, pos, Color.Black, forecolor ?? Color.White);
}
public void Dispose()

View File

@ -49,16 +49,15 @@ namespace BizHawk.Client.EmuHawk
private readonly Func<bool> _getIsSecondaryThrottlingDisabled;
private readonly OSDManager _osdManager;
public readonly OSDManager OSD = new OSDManager();
private Config GlobalConfig => GlobalWin.Config;
private IEmulator GlobalEmulator => GlobalWin.Emulator;
public DisplayManager(OSDManager osdManager, IGL gl, PresentationPanel presentationPanel, Func<bool> getIsSecondaryThrottlingDisabled)
public DisplayManager(IGL gl, PresentationPanel presentationPanel, Func<bool> getIsSecondaryThrottlingDisabled)
{
_getIsSecondaryThrottlingDisabled = getIsSecondaryThrottlingDisabled;
_osdManager = osdManager;
GL = gl;
// setup the GL context manager, needed for coping with multiple opengl cores vs opengl display method
@ -284,9 +283,9 @@ namespace BizHawk.Client.EmuHawk
ClipBounds = new Rectangle(0, 0, size.Width, size.Height)
};
Renderer.SetBlendState(GL.BlendNormal);
_osdManager.Begin(myBlitter);
_osdManager.DrawScreenInfo(myBlitter);
_osdManager.DrawMessages(myBlitter);
OSD.Begin(myBlitter);
OSD.DrawScreenInfo(myBlitter);
OSD.DrawMessages(myBlitter);
Renderer.End();
};

View File

@ -21,7 +21,6 @@ namespace BizHawk.Client.EmuHawk
public static IGL_TK IGL_GL;
public static Sound Sound;
public static readonly OSDManager OSD = new OSDManager();
public static Dictionary<string, object> UserBag { get; set; } = new Dictionary<string, object>();

View File

@ -336,7 +336,7 @@ namespace BizHawk.Client.EmuHawk
{
GraphicsControl = { MainWindow = true }
};
DisplayManager = new DisplayManager(OSD, GlobalWin.GL, _presentationPanel, () => DisableSecondaryThrottling);
DisplayManager = new DisplayManager(GlobalWin.GL, _presentationPanel, () => DisableSecondaryThrottling);
Controls.Add(_presentationPanel);
Controls.SetChildIndex(_presentationPanel, 0);
@ -845,7 +845,6 @@ namespace BizHawk.Client.EmuHawk
public EmuClientApi EmuClient { get; set; }
private InputManager InputManager => GlobalWin.InputManager;
private OSDManager OSD => GlobalWin.OSD;
private IVideoProvider _currentVideoProvider = NullVideo.Instance;
@ -861,6 +860,8 @@ namespace BizHawk.Client.EmuHawk
private DisplayManager DisplayManager;
private OSDManager OSD => DisplayManager.OSD;
public IMovieSession MovieSession
{
get => GlobalWin.MovieSession;

View File

@ -136,7 +136,7 @@ namespace BizHawk.Client.EmuHawk
LuaImp.GuiLibrary?.DrawFinish();
LuaImp?.Close();
GlobalWin.OSD.ClearGuiText();
DisplayManager.OSD.ClearGuiText();
}
else
{
@ -973,7 +973,7 @@ namespace BizHawk.Client.EmuHawk
{
// Shenanigans
// We want any gui.text messages from a script to immediately update even when paused
GlobalWin.OSD.ClearGuiText();
DisplayManager.OSD.ClearGuiText();
Tools.UpdateToolsAfter();
LuaImp.EndLuaDrawing();
LuaImp.StartLuaDrawing();

View File

@ -294,7 +294,7 @@ namespace BizHawk.Client.EmuHawk
return;
}
GlobalWin.OSD.ClearRamWatches();
DisplayManager.OSD.ClearRamWatches();
if (_watches.Any())
{
_watches.UpdateValues(Config.RamWatchDefinePrevious);
@ -313,11 +313,11 @@ namespace BizHawk.Client.EmuHawk
{
if (Config.DisplayRamWatch)
{
GlobalWin.OSD.ClearRamWatches();
DisplayManager.OSD.ClearRamWatches();
for (var i = 0; i < _watches.Count; i++)
{
var frozen = !_watches[i].IsSeparator && MainForm.CheatList.IsActive(_watches[i].Domain, _watches[i].Address);
GlobalWin.OSD.AddRamWatch(
DisplayManager.OSD.AddRamWatch(
_watches[i].ToDisplayString(),
new MessagePosition
{
@ -976,7 +976,7 @@ namespace BizHawk.Client.EmuHawk
if (!Config.DisplayRamWatch)
{
GlobalWin.OSD.ClearRamWatches();
DisplayManager.OSD.ClearRamWatches();
}
else
{