added PaletteType enum
This commit is contained in:
@@ -5,13 +5,10 @@ namespace OpenRa.Game.Graphics
|
||||
{
|
||||
class HardwarePalette : Sheet
|
||||
{
|
||||
public const int Shadow = 8;
|
||||
public const int Invuln = 9;
|
||||
public const int Chrome = 10;
|
||||
|
||||
const int maxEntries = 16;
|
||||
int allocated = 0;
|
||||
|
||||
//Note: addPalette calls should match the ordering in PaletteType.cs
|
||||
public HardwarePalette(Renderer renderer, Map map)
|
||||
: base(renderer,new Size(256, maxEntries))
|
||||
{
|
||||
|
||||
10
OpenRa.Game/Graphics/PaletteType.cs
Normal file
10
OpenRa.Game/Graphics/PaletteType.cs
Normal file
@@ -0,0 +1,10 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace OpenRa.Game.Graphics
|
||||
{
|
||||
//Note: should match the ordering in HardwarePalette.cs
|
||||
enum PaletteType { Gold, Blue, Red, Orange, Teal, Salmon, Green, Gray, Shadow, Invuln, Chrome };
|
||||
}
|
||||
@@ -54,13 +54,13 @@ namespace OpenRa.Game.Graphics
|
||||
}
|
||||
}
|
||||
|
||||
public void DrawSprite(Sprite s, float2 location, int palette)
|
||||
public void DrawSprite(Sprite s, float2 location, PaletteType palette)
|
||||
{
|
||||
if (s.sheet != currentSheet)
|
||||
Flush();
|
||||
|
||||
currentSheet = s.sheet;
|
||||
Util.FastCreateQuad(vertices, indices, location, s, palette, nv, ni);
|
||||
Util.FastCreateQuad(vertices, indices, location, s, (int) palette, nv, ni);
|
||||
nv += 4; ni += 6;
|
||||
if (++sprites >= spritesPerBatch)
|
||||
Flush();
|
||||
|
||||
@@ -197,7 +197,7 @@ namespace OpenRa.Game.Graphics
|
||||
var pipImages = new Animation("pips");
|
||||
pipImages.PlayFetchIndex("groups", () => (int)group);
|
||||
pipImages.Tick();
|
||||
spriteRenderer.DrawSprite(pipImages.Image, basePosition + new float2(-8, 1), HardwarePalette.Chrome);
|
||||
spriteRenderer.DrawSprite(pipImages.Image, basePosition + new float2(-8, 1), PaletteType.Chrome);
|
||||
}
|
||||
|
||||
void DrawPips(Actor selectedUnit, float2 basePosition)
|
||||
@@ -212,7 +212,7 @@ namespace OpenRa.Game.Graphics
|
||||
{
|
||||
var pipImages = new Animation("pips");
|
||||
pipImages.PlayRepeating(pipStrings[(int)pip]);
|
||||
spriteRenderer.DrawSprite(pipImages.Image, pipxyBase + pipxyOffset, HardwarePalette.Chrome);
|
||||
spriteRenderer.DrawSprite(pipImages.Image, pipxyBase + pipxyOffset, PaletteType.Chrome);
|
||||
pipxyOffset += new float2(4, 0);
|
||||
|
||||
if (pipxyOffset.X+5 > selectedUnit.SelectedSize.X)
|
||||
@@ -239,7 +239,7 @@ namespace OpenRa.Game.Graphics
|
||||
{
|
||||
var tagImages = new Animation("pips");
|
||||
tagImages.PlayRepeating(tagStrings[(int)tag]);
|
||||
spriteRenderer.DrawSprite(tagImages.Image, tagxyBase + tagxyOffset, HardwarePalette.Chrome);
|
||||
spriteRenderer.DrawSprite(tagImages.Image, tagxyBase + tagxyOffset, PaletteType.Chrome);
|
||||
|
||||
// Increment row
|
||||
tagxyOffset.Y += 8;
|
||||
|
||||
Reference in New Issue
Block a user