From 1d835edfca8c768878337279aa3ab31b6409f497 Mon Sep 17 00:00:00 2001 From: Paul Chote Date: Sat, 9 May 2015 20:01:01 +0100 Subject: [PATCH] Split PaletteReference into its own file. --- OpenRA.Game/Graphics/PaletteReference.cs | 37 ++++++++++++++++++++++++ OpenRA.Game/Graphics/WorldRenderer.cs | 17 ----------- OpenRA.Game/OpenRA.Game.csproj | 1 + 3 files changed, 38 insertions(+), 17 deletions(-) create mode 100644 OpenRA.Game/Graphics/PaletteReference.cs diff --git a/OpenRA.Game/Graphics/PaletteReference.cs b/OpenRA.Game/Graphics/PaletteReference.cs new file mode 100644 index 0000000000..88ffdae1e3 --- /dev/null +++ b/OpenRA.Game/Graphics/PaletteReference.cs @@ -0,0 +1,37 @@ +#region Copyright & License Information +/* + * Copyright 2007-2015 The OpenRA Developers (see AUTHORS) + * This file is part of OpenRA, which is free software. It is made + * available to you under the terms of the GNU General Public License + * as published by the Free Software Foundation. For more information, + * see COPYING. + */ +#endregion + +using System; +using System.Collections.Generic; +using System.Drawing; +using System.Linq; +using OpenRA.Traits; + +namespace OpenRA.Graphics +{ + public sealed class PaletteReference + { + readonly float index; + readonly HardwarePalette hardwarePalette; + + public readonly string Name; + public IPalette Palette { get; internal set; } + public float TextureIndex { get { return index / hardwarePalette.Height; } } + public float TextureMidIndex { get { return (index + 0.5f) / hardwarePalette.Height; } } + + public PaletteReference(string name, int index, IPalette palette, HardwarePalette hardwarePalette) + { + Name = name; + Palette = palette; + this.index = index; + this.hardwarePalette = hardwarePalette; + } + } +} diff --git a/OpenRA.Game/Graphics/WorldRenderer.cs b/OpenRA.Game/Graphics/WorldRenderer.cs index 4f3ba875d4..ba10875bbc 100644 --- a/OpenRA.Game/Graphics/WorldRenderer.cs +++ b/OpenRA.Game/Graphics/WorldRenderer.cs @@ -16,23 +16,6 @@ using OpenRA.Traits; namespace OpenRA.Graphics { - public class PaletteReference - { - public readonly string Name; - public IPalette Palette { get; internal set; } - readonly float index; - readonly HardwarePalette hardwarePalette; - public float TextureIndex { get { return index / hardwarePalette.Height; } } - public float TextureMidIndex { get { return (index + 0.5f) / hardwarePalette.Height; } } - public PaletteReference(string name, int index, IPalette palette, HardwarePalette hardwarePalette) - { - Name = name; - Palette = palette; - this.index = index; - this.hardwarePalette = hardwarePalette; - } - } - public sealed class WorldRenderer : IDisposable { public static readonly Func RenderableScreenZPositionComparisonKey = diff --git a/OpenRA.Game/OpenRA.Game.csproj b/OpenRA.Game/OpenRA.Game.csproj index c56f82c42f..cac0eb53ec 100644 --- a/OpenRA.Game/OpenRA.Game.csproj +++ b/OpenRA.Game/OpenRA.Game.csproj @@ -238,6 +238,7 @@ +