Cleanup code to create GUI Renderer.
This commit is contained in:
parent
436a853c96
commit
303e8d41e9
|
@ -149,6 +149,7 @@
|
|||
<Compile Include="ControllerBinding.cs" />
|
||||
<Compile Include="CoreFileProvider.cs" />
|
||||
<Compile Include="ExceptionClasses.cs" />
|
||||
<Compile Include="Extensions.cs" />
|
||||
<Compile Include="FirmwareManager.cs" />
|
||||
<Compile Include="Global.cs" />
|
||||
<Compile Include="inputAdapters\AutoPattern.cs" />
|
||||
|
@ -316,6 +317,10 @@
|
|||
<Project>{f51946ea-827f-4d82-b841-1f2f6d060312}</Project>
|
||||
<Name>BizHawk.Emulation.DiscSystem</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\Bizware\BizHawk.Bizware.BizwareGL.GdiPlus\BizHawk.Bizware.BizwareGL.GdiPlus.csproj">
|
||||
<Project>{337ca23e-65e7-44e1-9411-97ee08bb8116}</Project>
|
||||
<Name>BizHawk.Bizware.BizwareGL.GdiPlus</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\Bizware\BizHawk.Bizware.BizwareGL.OpenTK\BizHawk.Bizware.BizwareGL.OpenTK.csproj">
|
||||
<Project>{5160CFB1-5389-47C1-B7F6-8A0DC97641EE}</Project>
|
||||
<Name>BizHawk.Bizware.BizwareGL.OpenTK</Name>
|
||||
|
|
|
@ -0,0 +1,23 @@
|
|||
using System;
|
||||
using BizHawk.Bizware.BizwareGL;
|
||||
using BizHawk.Bizware.BizwareGL.Drivers.GdiPlus;
|
||||
using BizHawk.Bizware.BizwareGL.Drivers.OpenTK;
|
||||
using BizHawk.Bizware.BizwareGL.Drivers.SlimDX;
|
||||
|
||||
namespace BizHawk.Client.Common
|
||||
{
|
||||
public static class Extensions
|
||||
{
|
||||
public static IGuiRenderer CreateRenderer(this IGL gl)
|
||||
{
|
||||
if (gl is IGL_TK)
|
||||
return new GuiRenderer(gl);
|
||||
if (gl is IGL_SlimDX9)
|
||||
return new GuiRenderer(gl);
|
||||
if (gl is IGL_GdiPlus)
|
||||
return new GDIPlusGuiRenderer((IGL_GdiPlus)gl);
|
||||
|
||||
throw new NotSupportedException();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -46,12 +46,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
//it's sort of important for these to be initialized to something nonzero
|
||||
currEmuWidth = currEmuHeight = 1;
|
||||
|
||||
if (GL is BizHawk.Bizware.BizwareGL.Drivers.OpenTK.IGL_TK)
|
||||
Renderer = new GuiRenderer(GL);
|
||||
else if (GL is BizHawk.Bizware.BizwareGL.Drivers.SlimDX.IGL_SlimDX9)
|
||||
Renderer = new GuiRenderer(GL);
|
||||
else
|
||||
Renderer = new GDIPlusGuiRenderer((BizHawk.Bizware.BizwareGL.Drivers.GdiPlus.IGL_GdiPlus)GL);
|
||||
Renderer = GL.CreateRenderer();
|
||||
|
||||
VideoTextureFrugalizer = new TextureFrugalizer(GL);
|
||||
|
||||
|
|
|
@ -172,17 +172,9 @@ namespace BizHawk.Client.EmuHawk
|
|||
}
|
||||
|
||||
//try creating a GUI Renderer. If that doesn't succeed. we fallback
|
||||
//TODO - need a factory for the GUI Renderer, I hate pasting this code
|
||||
try
|
||||
{
|
||||
BizHawk.Bizware.BizwareGL.IGuiRenderer Renderer;
|
||||
if (GlobalWin.GL is BizHawk.Bizware.BizwareGL.Drivers.OpenTK.IGL_TK)
|
||||
Renderer = new BizHawk.Bizware.BizwareGL.GuiRenderer(GlobalWin.GL);
|
||||
else if (GlobalWin.GL is BizHawk.Bizware.BizwareGL.Drivers.SlimDX.IGL_SlimDX9)
|
||||
Renderer = new BizHawk.Bizware.BizwareGL.GuiRenderer(GlobalWin.GL);
|
||||
else
|
||||
Renderer = new BizHawk.Bizware.BizwareGL.Drivers.GdiPlus.GDIPlusGuiRenderer((BizHawk.Bizware.BizwareGL.Drivers.GdiPlus.IGL_GdiPlus)GlobalWin.GL);
|
||||
Renderer.Dispose();
|
||||
using (GlobalWin.GL.CreateRenderer()) { }
|
||||
}
|
||||
catch(Exception ex)
|
||||
{
|
||||
|
|
|
@ -47,12 +47,7 @@ namespace BizHawk.Client.MultiHawk
|
|||
//it's sort of important for these to be initialized to something nonzero
|
||||
currEmuWidth = currEmuHeight = 1;
|
||||
|
||||
if (GL is BizHawk.Bizware.BizwareGL.Drivers.OpenTK.IGL_TK)
|
||||
Renderer = new GuiRenderer(GL);
|
||||
else if (GL is BizHawk.Bizware.BizwareGL.Drivers.SlimDX.IGL_SlimDX9)
|
||||
Renderer = new GuiRenderer(GL);
|
||||
else
|
||||
Renderer = new GDIPlusGuiRenderer((BizHawk.Bizware.BizwareGL.Drivers.GdiPlus.IGL_GdiPlus)GL);
|
||||
Renderer = GL.CreateRenderer();
|
||||
|
||||
VideoTextureFrugalizer = new TextureFrugalizer(GL);
|
||||
|
||||
|
|
Loading…
Reference in New Issue