Split PaletteReference into its own file.
This commit is contained in:
37
OpenRA.Game/Graphics/PaletteReference.cs
Normal file
37
OpenRA.Game/Graphics/PaletteReference.cs
Normal file
@@ -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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -16,23 +16,6 @@ using OpenRA.Traits;
|
|||||||
|
|
||||||
namespace OpenRA.Graphics
|
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 sealed class WorldRenderer : IDisposable
|
||||||
{
|
{
|
||||||
public static readonly Func<IRenderable, int> RenderableScreenZPositionComparisonKey =
|
public static readonly Func<IRenderable, int> RenderableScreenZPositionComparisonKey =
|
||||||
|
|||||||
@@ -238,6 +238,7 @@
|
|||||||
<Compile Include="Widgets\ChromeMetrics.cs" />
|
<Compile Include="Widgets\ChromeMetrics.cs" />
|
||||||
<Compile Include="Widgets\WidgetUtils.cs" />
|
<Compile Include="Widgets\WidgetUtils.cs" />
|
||||||
<Compile Include="Widgets\WorldInteractionControllerWidget.cs" />
|
<Compile Include="Widgets\WorldInteractionControllerWidget.cs" />
|
||||||
|
<Compile Include="Graphics\PaletteReference.cs" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Compile Include="FileSystem\D2kSoundResources.cs" />
|
<Compile Include="FileSystem\D2kSoundResources.cs" />
|
||||||
|
|||||||
Reference in New Issue
Block a user