Rename IGraphicsDevice to IPlatformWindow.
This commit is contained in:
@@ -17,7 +17,7 @@ namespace OpenRA
|
|||||||
{
|
{
|
||||||
public interface IPlatform
|
public interface IPlatform
|
||||||
{
|
{
|
||||||
IGraphicsDevice CreateGraphics(Size size, WindowMode windowMode);
|
IPlatformWindow CreateWindow(Size size, WindowMode windowMode);
|
||||||
ISoundEngine CreateSound(string device);
|
ISoundEngine CreateSound(string device);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -34,7 +34,7 @@ namespace OpenRA
|
|||||||
DoubleMultiplicative
|
DoubleMultiplicative
|
||||||
}
|
}
|
||||||
|
|
||||||
public interface IGraphicsDevice : IDisposable
|
public interface IPlatformWindow : IDisposable
|
||||||
{
|
{
|
||||||
IVertexBuffer<Vertex> CreateVertexBuffer(int length);
|
IVertexBuffer<Vertex> CreateVertexBuffer(int length);
|
||||||
ITexture CreateTexture(Bitmap bitmap);
|
ITexture CreateTexture(Bitmap bitmap);
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ namespace OpenRA
|
|||||||
public RgbaSpriteRenderer RgbaSpriteRenderer { get; private set; }
|
public RgbaSpriteRenderer RgbaSpriteRenderer { get; private set; }
|
||||||
public IReadOnlyDictionary<string, SpriteFont> Fonts;
|
public IReadOnlyDictionary<string, SpriteFont> Fonts;
|
||||||
|
|
||||||
internal IGraphicsDevice Device { get; private set; }
|
internal IPlatformWindow Device { get; private set; }
|
||||||
internal int SheetSize { get; private set; }
|
internal int SheetSize { get; private set; }
|
||||||
internal int TempBufferSize { get; private set; }
|
internal int TempBufferSize { get; private set; }
|
||||||
|
|
||||||
@@ -51,7 +51,7 @@ namespace OpenRA
|
|||||||
{
|
{
|
||||||
var resolution = GetResolution(graphicSettings);
|
var resolution = GetResolution(graphicSettings);
|
||||||
|
|
||||||
Device = platform.CreateGraphics(new Size(resolution.Width, resolution.Height), graphicSettings.Mode);
|
Device = platform.CreateWindow(new Size(resolution.Width, resolution.Height), graphicSettings.Mode);
|
||||||
|
|
||||||
TempBufferSize = graphicSettings.BatchSize;
|
TempBufferSize = graphicSettings.BatchSize;
|
||||||
SheetSize = graphicSettings.SheetSize;
|
SheetSize = graphicSettings.SheetSize;
|
||||||
|
|||||||
@@ -16,9 +16,9 @@ namespace OpenRA.Platforms.Default
|
|||||||
{
|
{
|
||||||
public class DefaultPlatform : IPlatform
|
public class DefaultPlatform : IPlatform
|
||||||
{
|
{
|
||||||
public IGraphicsDevice CreateGraphics(Size size, WindowMode windowMode)
|
public IPlatformWindow CreateWindow(Size size, WindowMode windowMode)
|
||||||
{
|
{
|
||||||
return new Sdl2GraphicsDevice(size, windowMode);
|
return new Sdl2PlatformWindow(size, windowMode);
|
||||||
}
|
}
|
||||||
|
|
||||||
public ISoundEngine CreateSound(string device)
|
public ISoundEngine CreateSound(string device)
|
||||||
|
|||||||
@@ -48,7 +48,7 @@
|
|||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Compile Include="DefaultPlatform.cs" />
|
<Compile Include="DefaultPlatform.cs" />
|
||||||
<Compile Include="Sdl2GraphicsDevice.cs" />
|
<Compile Include="Sdl2PlatformWindow.cs" />
|
||||||
<Compile Include="Sdl2Input.cs" />
|
<Compile Include="Sdl2Input.cs" />
|
||||||
<Compile Include="Shader.cs" />
|
<Compile Include="Shader.cs" />
|
||||||
<Compile Include="FrameBuffer.cs" />
|
<Compile Include="FrameBuffer.cs" />
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ namespace OpenRA.Platforms.Default
|
|||||||
| ((raw & (int)SDL.SDL_Keymod.KMOD_SHIFT) != 0 ? Modifiers.Shift : 0);
|
| ((raw & (int)SDL.SDL_Keymod.KMOD_SHIFT) != 0 ? Modifiers.Shift : 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
int2 EventPosition(Sdl2GraphicsDevice device, int x, int y)
|
int2 EventPosition(Sdl2PlatformWindow device, int x, int y)
|
||||||
{
|
{
|
||||||
// On Windows and Linux (X11) events are given in surface coordinates
|
// On Windows and Linux (X11) events are given in surface coordinates
|
||||||
// These must be scaled to our effective window coordinates
|
// These must be scaled to our effective window coordinates
|
||||||
@@ -50,7 +50,7 @@ namespace OpenRA.Platforms.Default
|
|||||||
return new int2(x, y);
|
return new int2(x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void PumpInput(Sdl2GraphicsDevice device, IInputHandler inputHandler)
|
public void PumpInput(Sdl2PlatformWindow device, IInputHandler inputHandler)
|
||||||
{
|
{
|
||||||
var mods = MakeModifiers((int)SDL.SDL_GetModState());
|
var mods = MakeModifiers((int)SDL.SDL_GetModState());
|
||||||
var scrollDelta = 0;
|
var scrollDelta = 0;
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ using SDL2;
|
|||||||
|
|
||||||
namespace OpenRA.Platforms.Default
|
namespace OpenRA.Platforms.Default
|
||||||
{
|
{
|
||||||
sealed class Sdl2GraphicsDevice : ThreadAffine, IGraphicsDevice
|
sealed class Sdl2PlatformWindow : ThreadAffine, IPlatformWindow
|
||||||
{
|
{
|
||||||
readonly Sdl2Input input;
|
readonly Sdl2Input input;
|
||||||
|
|
||||||
@@ -33,7 +33,7 @@ namespace OpenRA.Platforms.Default
|
|||||||
[DllImport("user32.dll")]
|
[DllImport("user32.dll")]
|
||||||
static extern bool SetProcessDPIAware();
|
static extern bool SetProcessDPIAware();
|
||||||
|
|
||||||
public Sdl2GraphicsDevice(Size windowSize, WindowMode windowMode)
|
public Sdl2PlatformWindow(Size windowSize, WindowMode windowMode)
|
||||||
{
|
{
|
||||||
Console.WriteLine("Using SDL 2 with OpenGL renderer");
|
Console.WriteLine("Using SDL 2 with OpenGL renderer");
|
||||||
WindowSize = windowSize;
|
WindowSize = windowSize;
|
||||||
Reference in New Issue
Block a user