Replace specialised DisplayManager interfaces with DisplayManagerBase
This commit is contained in:
parent
798aa9d039
commit
b8f5050d6c
|
@ -11,7 +11,7 @@ namespace BizHawk.Client.Common
|
|||
{
|
||||
private readonly Config _config;
|
||||
|
||||
private readonly IWindowCoordsTransformer _displayManager;
|
||||
private readonly DisplayManagerBase _displayManager;
|
||||
|
||||
private readonly IMainFormForApi _mainForm;
|
||||
|
||||
|
@ -35,7 +35,7 @@ namespace BizHawk.Client.Common
|
|||
|
||||
public event StateSavedEventHandler StateSaved;
|
||||
|
||||
public EmuClientApi(Action<string> logCallback, IMainFormForApi mainForm, IWindowCoordsTransformer displayManager, Config config, IEmulator emulator, IGameInfo game)
|
||||
public EmuClientApi(Action<string> logCallback, IMainFormForApi mainForm, DisplayManagerBase displayManager, Config config, IEmulator emulator, IGameInfo game)
|
||||
{
|
||||
_config = config;
|
||||
_displayManager = displayManager;
|
||||
|
|
|
@ -17,7 +17,7 @@ namespace BizHawk.Client.Common
|
|||
|
||||
private readonly Action<string> LogCallback;
|
||||
|
||||
private readonly IDisplayManagerForApi _displayManager;
|
||||
private readonly DisplayManagerBase _displayManager;
|
||||
|
||||
private readonly Dictionary<string, Image> _imageCache = new Dictionary<string, Image>();
|
||||
|
||||
|
@ -51,7 +51,7 @@ namespace BizHawk.Client.Common
|
|||
|
||||
public bool HasGUISurface => _GUISurface != null;
|
||||
|
||||
public GuiApi(Action<string> logCallback, IDisplayManagerForApi displayManager)
|
||||
public GuiApi(Action<string> logCallback, DisplayManagerBase displayManager)
|
||||
{
|
||||
LogCallback = logCallback;
|
||||
_displayManager = displayManager;
|
||||
|
|
|
@ -5,11 +5,11 @@ namespace BizHawk.Client.Common
|
|||
{
|
||||
public sealed class InputApi : IInputApi
|
||||
{
|
||||
private readonly IWindowCoordsTransformer _displayManager;
|
||||
private readonly DisplayManagerBase _displayManager;
|
||||
|
||||
private readonly InputManager _inputManager;
|
||||
|
||||
public InputApi(IWindowCoordsTransformer displayManager, InputManager inputManager)
|
||||
public InputApi(DisplayManagerBase displayManager, InputManager inputManager)
|
||||
{
|
||||
_displayManager = displayManager;
|
||||
_inputManager = inputManager;
|
||||
|
|
|
@ -25,7 +25,7 @@ namespace BizHawk.Client.Common
|
|||
/// Its job is to receive OSD and emulator outputs, and produce one single buffer (BitmapBuffer? Texture2d?) for display by the PresentationPanel.
|
||||
/// Details TBD
|
||||
/// </summary>
|
||||
public class DisplayManagerBase : IDisplayManagerForApi, IWindowCoordsTransformer, IDisposable
|
||||
public class DisplayManagerBase : IDisposable
|
||||
{
|
||||
private static DisplaySurface CreateDisplaySurface(int w, int h) => new(w, h);
|
||||
|
||||
|
|
|
@ -1,20 +0,0 @@
|
|||
using System;
|
||||
using System.Drawing.Text;
|
||||
|
||||
namespace BizHawk.Client.Common
|
||||
{
|
||||
public interface IDisplayManagerForApi
|
||||
{
|
||||
PrivateFontCollection CustomFonts { get; }
|
||||
|
||||
OSDManager OSD { get; }
|
||||
|
||||
/// <summary>locks the surface with ID <paramref name="surfaceID"/></summary>
|
||||
/// <exception cref="InvalidOperationException">already locked, or unknown surface</exception>
|
||||
IDisplaySurface LockApiHawkSurface(DisplaySurfaceID surfaceID, bool clear = true);
|
||||
|
||||
/// <summary>unlocks the given <paramref name="surface"/>, which must be a locked surface produced by <see cref="LockApiHawkSurface"/></summary>
|
||||
/// <exception cref="InvalidOperationException">already unlocked</exception>
|
||||
void UnlockApiHawkSurface(IDisplaySurface surface);
|
||||
}
|
||||
}
|
|
@ -1,17 +0,0 @@
|
|||
using System.Drawing;
|
||||
|
||||
namespace BizHawk.Client.Common
|
||||
{
|
||||
public interface IWindowCoordsTransformer
|
||||
{
|
||||
(int Left, int Top, int Right, int Bottom) ClientExtraPadding { get; set; }
|
||||
|
||||
(int Left, int Top, int Right, int Bottom) GameExtraPadding { get; set; }
|
||||
|
||||
Size GetPanelNativeSize();
|
||||
|
||||
Point TransformPoint(Point p);
|
||||
|
||||
Point UntransformPoint(Point p);
|
||||
}
|
||||
}
|
|
@ -36,7 +36,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
IEmulatorServiceProvider serviceProvider,
|
||||
Action<string> logCallback,
|
||||
IMainFormForApi mainForm,
|
||||
IDisplayManagerForApi displayManager,
|
||||
DisplayManagerBase displayManager,
|
||||
InputManager inputManager,
|
||||
IMovieSession movieSession,
|
||||
ToolManager toolManager,
|
||||
|
@ -48,8 +48,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
{
|
||||
[typeof(Action<string>)] = logCallback,
|
||||
[typeof(IMainFormForApi)] = mainForm,
|
||||
[typeof(IDisplayManagerForApi)] = displayManager,
|
||||
[typeof(IWindowCoordsTransformer)] = displayManager,
|
||||
[typeof(DisplayManagerBase)] = displayManager,
|
||||
[typeof(InputManager)] = inputManager,
|
||||
[typeof(IMovieSession)] = movieSession,
|
||||
[typeof(ToolManager)] = toolManager,
|
||||
|
@ -71,7 +70,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
public static IExternalApiProvider Restart(
|
||||
IEmulatorServiceProvider serviceProvider,
|
||||
IMainFormForApi mainForm,
|
||||
IDisplayManagerForApi displayManager,
|
||||
DisplayManagerBase displayManager,
|
||||
InputManager inputManager,
|
||||
IMovieSession movieSession,
|
||||
ToolManager toolManager,
|
||||
|
@ -88,7 +87,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
IEmulatorServiceProvider serviceProvider,
|
||||
Action<string> logCallback,
|
||||
IMainFormForApi mainForm,
|
||||
IDisplayManagerForApi displayManager,
|
||||
DisplayManagerBase displayManager,
|
||||
InputManager inputManager,
|
||||
IMovieSession movieSession,
|
||||
ToolManager toolManager,
|
||||
|
|
|
@ -20,7 +20,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
LuaFunctionList registeredFuncList,
|
||||
IEmulatorServiceProvider serviceProvider,
|
||||
MainForm mainForm,
|
||||
IDisplayManagerForApi displayManager,
|
||||
DisplayManagerBase displayManager,
|
||||
InputManager inputManager,
|
||||
Config config,
|
||||
IEmulator emulator,
|
||||
|
@ -110,7 +110,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
private ApiContainer _apiContainer;
|
||||
|
||||
private readonly IDisplayManagerForApi _displayManager;
|
||||
private readonly DisplayManagerBase _displayManager;
|
||||
|
||||
private GuiApi GuiAPI => (GuiApi) _apiContainer.Gui;
|
||||
|
||||
|
|
Loading…
Reference in New Issue