From 5ecc1ebefcc82a9616a1b10d35b3b28684a22ce9 Mon Sep 17 00:00:00 2001 From: Chris Forbes Date: Sun, 22 May 2011 22:10:48 +1200 Subject: [PATCH] split IGraphicsDevice.{Present,PumpInput} --- OpenRA.FileFormats/Graphics/IGraphicsDevice.cs | 3 ++- OpenRA.Game/Graphics/Renderer.cs | 3 ++- OpenRA.Renderer.Cg/GraphicsDevice.cs | 6 +++++- OpenRA.Renderer.Gl/GraphicsDevice.cs | 6 +++++- OpenRA.Renderer.Null/NullGraphicsDevice.cs | 3 ++- 5 files changed, 16 insertions(+), 5 deletions(-) diff --git a/OpenRA.FileFormats/Graphics/IGraphicsDevice.cs b/OpenRA.FileFormats/Graphics/IGraphicsDevice.cs index 790f5182c5..0e51dc109d 100755 --- a/OpenRA.FileFormats/Graphics/IGraphicsDevice.cs +++ b/OpenRA.FileFormats/Graphics/IGraphicsDevice.cs @@ -38,7 +38,8 @@ namespace OpenRA.FileFormats.Graphics int GpuMemoryUsed { get; } void Clear( Color color ); - void Present( IInputHandler inputHandler ); + void Present(); + void PumpInput(IInputHandler inputHandler); void DrawPrimitives( PrimitiveType type, int firstVertex, int numVertices ); diff --git a/OpenRA.Game/Graphics/Renderer.cs b/OpenRA.Game/Graphics/Renderer.cs index ff34b09f57..77fdb12085 100644 --- a/OpenRA.Game/Graphics/Renderer.cs +++ b/OpenRA.Game/Graphics/Renderer.cs @@ -94,7 +94,8 @@ namespace OpenRA.Graphics public void EndFrame( IInputHandler inputHandler ) { Flush(); - device.Present( inputHandler ); + device.PumpInput(inputHandler); + device.Present(); } public void DrawBatch(IVertexBuffer vertices, diff --git a/OpenRA.Renderer.Cg/GraphicsDevice.cs b/OpenRA.Renderer.Cg/GraphicsDevice.cs index 2faaa6f2e5..1688bb498c 100755 --- a/OpenRA.Renderer.Cg/GraphicsDevice.cs +++ b/OpenRA.Renderer.Cg/GraphicsDevice.cs @@ -181,9 +181,13 @@ namespace OpenRA.Renderer.Cg } } - public void Present( IInputHandler inputHandler ) + public void Present() { Sdl.SDL_GL_SwapBuffers(); + } + + public void PumpInput( IInputHandler inputHandler ) + { Game.HasInputFocus = 0 != ( Sdl.SDL_GetAppState() & Sdl.SDL_APPINPUTFOCUS ); var mods = MakeModifiers( Sdl.SDL_GetModState() ); diff --git a/OpenRA.Renderer.Gl/GraphicsDevice.cs b/OpenRA.Renderer.Gl/GraphicsDevice.cs index 3bd5c75ba7..624e774da6 100755 --- a/OpenRA.Renderer.Gl/GraphicsDevice.cs +++ b/OpenRA.Renderer.Gl/GraphicsDevice.cs @@ -180,9 +180,13 @@ namespace OpenRA.Renderer.Glsl } } - public void Present( IInputHandler inputHandler ) + public void Present() { Sdl.SDL_GL_SwapBuffers(); + } + + public void PumpInput( IInputHandler inputHandler ) + { Game.HasInputFocus = 0 != ( Sdl.SDL_GetAppState() & Sdl.SDL_APPINPUTFOCUS ); var mods = MakeModifiers( Sdl.SDL_GetModState() ); diff --git a/OpenRA.Renderer.Null/NullGraphicsDevice.cs b/OpenRA.Renderer.Null/NullGraphicsDevice.cs index b8853fbdfe..fa507b4726 100644 --- a/OpenRA.Renderer.Null/NullGraphicsDevice.cs +++ b/OpenRA.Renderer.Null/NullGraphicsDevice.cs @@ -33,7 +33,8 @@ namespace OpenRA.Renderer.Null public void Clear(Color c) { } - public void Present(IInputHandler ih) + public void Present() { } + public void PumpInput(IInputHandler ih) { Game.HasInputFocus = false; ih.ModifierKeys(Modifiers.None);