slight cleanup in Renderer

This commit is contained in:
Chris Forbes
2011-05-05 18:10:13 +12:00
parent a52d7fb496
commit 9434dd993a
2 changed files with 7 additions and 4 deletions

View File

@@ -112,16 +112,19 @@ namespace OpenRA.Graphics
public static Size Resolution { get { return device.WindowSize; } } public static Size Resolution { get { return device.WindowSize; } }
internal static void Initialize( OpenRA.FileFormats.Graphics.WindowMode windowMode ) internal static void Initialize( WindowMode windowMode )
{ {
var resolution = GetResolution( windowMode ); var resolution = GetResolution( windowMode );
device = CreateDevice( Assembly.LoadFile( Path.GetFullPath( "OpenRA.Renderer.{0}.dll".F(Game.Settings.Graphics.Renderer) ) ), resolution.Width, resolution.Height, windowMode, false ); var rendererPath = Path.GetFullPath( "OpenRA.Renderer.{0}.dll".F(Game.Settings.Graphics.Renderer) );
device = CreateDevice( Assembly.LoadFile( rendererPath ), resolution.Width, resolution.Height, windowMode, false );
} }
static Size GetResolution(WindowMode windowmode) static Size GetResolution(WindowMode windowmode)
{ {
var desktopResolution = Screen.PrimaryScreen.Bounds.Size; var desktopResolution = Screen.PrimaryScreen.Bounds.Size;
var customSize = (windowmode == WindowMode.Windowed) ? Game.Settings.Graphics.WindowedSize : Game.Settings.Graphics.FullscreenSize; var customSize = (windowmode == WindowMode.Windowed)
? Game.Settings.Graphics.WindowedSize
: Game.Settings.Graphics.FullscreenSize;
if (customSize.X > 0 && customSize.Y > 0) if (customSize.X > 0 && customSize.Y > 0)
{ {

View File

@@ -8,11 +8,11 @@
*/ */
#endregion #endregion
using System;
using System.Drawing; using System.Drawing;
using System.IO; using System.IO;
using OpenRA.FileFormats.Graphics; using OpenRA.FileFormats.Graphics;
using OpenRA.Graphics; using OpenRA.Graphics;
using System;
[assembly: Renderer(typeof(OpenRA.Renderer.Null.NullGraphicsDevice))] [assembly: Renderer(typeof(OpenRA.Renderer.Null.NullGraphicsDevice))]