Extract a tiny interface from DisplayManager for ApiHawk
This commit is contained in:
parent
0704db5940
commit
7edf3b36ad
|
@ -0,0 +1,20 @@
|
||||||
|
using System;
|
||||||
|
using System.Drawing.Text;
|
||||||
|
|
||||||
|
namespace BizHawk.Client.Common
|
||||||
|
{
|
||||||
|
public interface IDisplayManagerForApi
|
||||||
|
{
|
||||||
|
PrivateFontCollection CustomFonts { get; }
|
||||||
|
|
||||||
|
OSDManager OSD { get; }
|
||||||
|
|
||||||
|
/// <summary>locks the lua surface called <paramref name="name"/></summary>
|
||||||
|
/// <exception cref="InvalidOperationException">already locked, or unknown surface</exception>
|
||||||
|
DisplaySurface LockLuaSurface(string name, bool clear = true);
|
||||||
|
|
||||||
|
/// <summary>unlocks this DisplaySurface which had better have been locked as a lua surface</summary>
|
||||||
|
/// <exception cref="InvalidOperationException">already unlocked</exception>
|
||||||
|
void UnlockLuaSurface(DisplaySurface surface);
|
||||||
|
}
|
||||||
|
}
|
|
@ -37,7 +37,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
IEmulatorServiceProvider serviceProvider,
|
IEmulatorServiceProvider serviceProvider,
|
||||||
Action<string> logCallback,
|
Action<string> logCallback,
|
||||||
IMainFormForApi mainForm,
|
IMainFormForApi mainForm,
|
||||||
DisplayManager displayManager,
|
IDisplayManagerForApi displayManager,
|
||||||
InputManager inputManager,
|
InputManager inputManager,
|
||||||
IMovieSession movieSession,
|
IMovieSession movieSession,
|
||||||
ToolManager toolManager,
|
ToolManager toolManager,
|
||||||
|
@ -49,7 +49,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
{
|
{
|
||||||
[typeof(Action<string>)] = logCallback,
|
[typeof(Action<string>)] = logCallback,
|
||||||
[typeof(IMainFormForApi)] = mainForm,
|
[typeof(IMainFormForApi)] = mainForm,
|
||||||
[typeof(DisplayManager)] = displayManager,
|
[typeof(IDisplayManagerForApi)] = displayManager,
|
||||||
[typeof(IWindowCoordsTransformer)] = displayManager,
|
[typeof(IWindowCoordsTransformer)] = displayManager,
|
||||||
[typeof(InputManager)] = inputManager,
|
[typeof(InputManager)] = inputManager,
|
||||||
[typeof(IMovieSession)] = movieSession,
|
[typeof(IMovieSession)] = movieSession,
|
||||||
|
@ -72,7 +72,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
public static IExternalApiProvider Restart(
|
public static IExternalApiProvider Restart(
|
||||||
IEmulatorServiceProvider serviceProvider,
|
IEmulatorServiceProvider serviceProvider,
|
||||||
IMainFormForApi mainForm,
|
IMainFormForApi mainForm,
|
||||||
DisplayManager displayManager,
|
IDisplayManagerForApi displayManager,
|
||||||
InputManager inputManager,
|
InputManager inputManager,
|
||||||
IMovieSession movieSession,
|
IMovieSession movieSession,
|
||||||
ToolManager toolManager,
|
ToolManager toolManager,
|
||||||
|
@ -89,7 +89,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
IEmulatorServiceProvider serviceProvider,
|
IEmulatorServiceProvider serviceProvider,
|
||||||
Action<string> logCallback,
|
Action<string> logCallback,
|
||||||
IMainFormForApi mainForm,
|
IMainFormForApi mainForm,
|
||||||
DisplayManager displayManager,
|
IDisplayManagerForApi displayManager,
|
||||||
InputManager inputManager,
|
InputManager inputManager,
|
||||||
IMovieSession movieSession,
|
IMovieSession movieSession,
|
||||||
ToolManager toolManager,
|
ToolManager toolManager,
|
||||||
|
|
|
@ -18,7 +18,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
|
|
||||||
private readonly Action<string> LogCallback;
|
private readonly Action<string> LogCallback;
|
||||||
|
|
||||||
private readonly DisplayManager _displayManager;
|
private readonly IDisplayManagerForApi _displayManager;
|
||||||
|
|
||||||
private readonly Dictionary<string, Image> _imageCache = new Dictionary<string, Image>();
|
private readonly Dictionary<string, Image> _imageCache = new Dictionary<string, Image>();
|
||||||
|
|
||||||
|
@ -46,7 +46,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
|
|
||||||
public bool HasGUISurface => _GUISurface != null;
|
public bool HasGUISurface => _GUISurface != null;
|
||||||
|
|
||||||
public GuiApi(Action<string> logCallback, DisplayManager displayManager)
|
public GuiApi(Action<string> logCallback, IDisplayManagerForApi displayManager)
|
||||||
{
|
{
|
||||||
LogCallback = logCallback;
|
LogCallback = logCallback;
|
||||||
_displayManager = displayManager;
|
_displayManager = displayManager;
|
||||||
|
|
|
@ -30,7 +30,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
/// Its job is to receive OSD and emulator outputs, and produce one single buffer (BitmapBuffer? Texture2d?) for display by the PresentationPanel.
|
/// Its job is to receive OSD and emulator outputs, and produce one single buffer (BitmapBuffer? Texture2d?) for display by the PresentationPanel.
|
||||||
/// Details TBD
|
/// Details TBD
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class DisplayManager : IWindowCoordsTransformer, IDisposable
|
public class DisplayManager : IDisplayManagerForApi, IWindowCoordsTransformer, IDisposable
|
||||||
{
|
{
|
||||||
private class DisplayManagerRenderTargetProvider : IRenderTargetProvider
|
private class DisplayManagerRenderTargetProvider : IRenderTargetProvider
|
||||||
{
|
{
|
||||||
|
@ -49,7 +49,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
|
|
||||||
private readonly Func<bool> _getIsSecondaryThrottlingDisabled;
|
private readonly Func<bool> _getIsSecondaryThrottlingDisabled;
|
||||||
|
|
||||||
public readonly OSDManager OSD;
|
public OSDManager OSD { get; }
|
||||||
|
|
||||||
private Config GlobalConfig;
|
private Config GlobalConfig;
|
||||||
|
|
||||||
|
@ -214,7 +214,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// custom fonts that don't need to be installed on the user side
|
/// custom fonts that don't need to be installed on the user side
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public PrivateFontCollection CustomFonts = new PrivateFontCollection();
|
public PrivateFontCollection CustomFonts { get; } = new PrivateFontCollection();
|
||||||
|
|
||||||
private readonly TextureFrugalizer _videoTextureFrugalizer;
|
private readonly TextureFrugalizer _videoTextureFrugalizer;
|
||||||
private readonly Dictionary<string, TextureFrugalizer> _luaSurfaceFrugalizers = new Dictionary<string, TextureFrugalizer>();
|
private readonly Dictionary<string, TextureFrugalizer> _luaSurfaceFrugalizers = new Dictionary<string, TextureFrugalizer>();
|
||||||
|
|
|
@ -18,7 +18,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
public Win32LuaLibraries(
|
public Win32LuaLibraries(
|
||||||
IEmulatorServiceProvider serviceProvider,
|
IEmulatorServiceProvider serviceProvider,
|
||||||
MainForm mainForm,
|
MainForm mainForm,
|
||||||
DisplayManager displayManager,
|
IDisplayManagerForApi displayManager,
|
||||||
InputManager inputManager,
|
InputManager inputManager,
|
||||||
Config config,
|
Config config,
|
||||||
IEmulator emulator,
|
IEmulator emulator,
|
||||||
|
@ -104,7 +104,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
EnumerateLuaFunctions(nameof(LuaCanvas), typeof(LuaCanvas), null); // add LuaCanvas to Lua function reference table
|
EnumerateLuaFunctions(nameof(LuaCanvas), typeof(LuaCanvas), null); // add LuaCanvas to Lua function reference table
|
||||||
}
|
}
|
||||||
|
|
||||||
private readonly DisplayManager _displayManager;
|
private readonly IDisplayManagerForApi _displayManager;
|
||||||
|
|
||||||
private readonly InputManager _inputManager;
|
private readonly InputManager _inputManager;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue