Actually add minimap changes, and unfail build-tab chrome.xml entries

This commit is contained in:
Paul Chote
2010-01-09 20:47:08 +13:00
parent 8b59e9e3a6
commit 5ce4703ba4
3 changed files with 48 additions and 28 deletions

View File

@@ -45,7 +45,7 @@ namespace OpenRa.Game
readonly List<Pair<Rectangle, Action<bool>>> buttons = new List<Pair<Rectangle, Action<bool>>>(); readonly List<Pair<Rectangle, Action<bool>>> buttons = new List<Pair<Rectangle, Action<bool>>>();
readonly List<Sprite> digitSprites; readonly List<Sprite> digitSprites;
readonly Dictionary<string, Sprite[]> tabSprites; readonly Dictionary<string, string[]> tabSprites;
readonly Dictionary<string, Sprite> spsprites; readonly Dictionary<string, Sprite> spsprites;
readonly Sprite[] shimSprites; readonly Sprite[] shimSprites;
readonly Sprite blank; readonly Sprite blank;
@@ -149,11 +149,11 @@ namespace OpenRa.Game
.ToDictionary( .ToDictionary(
u => u.Key, u => u.Key,
u => SpriteSheetBuilder.LoadAllSprites(u.Value.Image)[0]); u => SpriteSheetBuilder.LoadAllSprites(u.Value.Image)[0]);
tabSprites = groups.Select( tabSprites = groups.Select(
(g, i) => Pair.New(g, (g, i) => Pair.New(g,
OpenRa.Game.Graphics.Util.MakeArray(3, OpenRa.Game.Graphics.Util.MakeArray(3,
n => SequenceProvider.GetImageFromCollection(renderer, "tabs-"+n,i.ToString())))) n => i.ToString())))
.ToDictionary(a => a.First, a => a.Second); .ToDictionary(a => a.First, a => a.Second);
cantBuild = new Animation("clock"); cantBuild = new Animation("clock");
@@ -305,10 +305,11 @@ namespace OpenRa.Game
CheckDeadTab(groupName); CheckDeadTab(groupName);
continue; continue;
} }
string[] tabKeys = { "normal", "ready", "selected" };
var producing = queue.CurrentItem(groupName); var producing = queue.CurrentItem(groupName);
var index = q.Key == currentTab ? 2 : (producing != null && producing.Done) ? 1 : 0; var index = q.Key == currentTab ? 2 : (producing != null && producing.Done) ? 1 : 0;
rgbaRenderer.DrawSprite(q.Value[index], new float2(x, y), PaletteType.Chrome); var race = (Game.LocalPlayer.Race == Race.Allies) ? "allies" : "soviet";
rgbaRenderer.DrawSprite(SequenceProvider.GetImageFromCollection(renderer,"tabs-"+tabKeys[index], race+"-"+q.Key), new float2(x, y), PaletteType.Chrome);
buttons.Add(Pair.New(new Rectangle(x, y, tabWidth, tabHeight), buttons.Add(Pair.New(new Rectangle(x, y, tabWidth, tabHeight),
(Action<bool>)(isLmb => currentTab = groupName))); (Action<bool>)(isLmb => currentTab = groupName)));

View File

@@ -107,9 +107,9 @@ namespace OpenRa.Game.Graphics
sheet.Texture.SetData(bitmap); sheet.Texture.SetData(bitmap);
} }
public void Draw(float2 pos, bool hasRadar, bool isJammed) public void Draw(RectangleF rect, bool hasRadar, bool isJammed)
{ {
rgbaRenderer.DrawSprite(sprite, pos, PaletteType.Chrome, new float2(192, 192)); rgbaRenderer.DrawSprite(sprite, new float2(rect.X, rect.Y), PaletteType.Chrome, new float2(rect.Width, rect.Height));
rgbaRenderer.Flush(); rgbaRenderer.Flush();
} }
} }

View File

@@ -28,28 +28,47 @@
<image name="8" x="136" y="0" width="13" height="17" /> <image name="8" x="136" y="0" width="13" height="17" />
<image name="9" x="149" y="0" width="13" height="17" /> <image name="9" x="149" y="0" width="13" height="17" />
</collection> </collection>
<collection name="tabs-0" src="specialbin.png"> <collection name="tabs-selected" src="tabs.png">
<image name="0" x="485" y="64" width="27" height="40" /> <image name="allies-Building" x="0" y="0" width="27" height="41" />
<image name="1" x="485" y="104" width="27" height="40" /> <image name="allies-Defense" x="0" y="40" width="27" height="41" />
<image name="2" x="485" y="144" width="27" height="40" /> <image name="allies-Infantry" x="0" y="80" width="27" height="41" />
<image name="3" x="485" y="184" width="27" height="40" /> <image name="allies-Vehicle" x="0" y="120" width="27" height="41" />
<image name="4" x="485" y="224" width="27" height="40" /> <image name="allies-Plane" x="0" y="160" width="27" height="41" />
<image name="5" x="485" y="264" width="27" height="40" /> <image name="allies-Ship" x="0" y="200" width="27" height="41" />
<image name="soviet-Building" x="80" y="0" width="27" height="41" />
<image name="soviet-Defense" x="80" y="40" width="27" height="41" />
<image name="soviet-Infantry" x="80" y="80" width="27" height="41" />
<image name="soviet-Vehicle" x="80" y="120" width="27" height="41" />
<image name="soviet-Plane" x="80" y="160" width="27" height="41" />
<image name="soviet-Ship" x="80" y="200" width="27" height="41" />
</collection> </collection>
<collection name="tabs-1" src="specialbin.png"> <collection name="tabs-ready" src="tabs.png">
<image name="0" x="458" y="64" width="27" height="40" /> <image name="allies-Building" x="27" y="0" width="27" height="41" />
<image name="1" x="458" y="104" width="27" height="40" /> <image name="allies-Defense" x="27" y="40" width="27" height="41" />
<image name="2" x="458" y="144" width="27" height="40" /> <image name="allies-Infantry" x="27" y="80" width="27" height="41" />
<image name="3" x="458" y="184" width="27" height="40" /> <image name="allies-Vehicle" x="27" y="120" width="27" height="41" />
<image name="4" x="458" y="224" width="27" height="40" /> <image name="allies-Plane" x="27" y="160" width="27" height="41" />
<image name="5" x="458" y="264" width="27" height="40" /> <image name="allies-Ship" x="27" y="200" width="27" height="41" />
<image name="soviet-Building" x="107" y="0" width="27" height="41" />
<image name="soviet-Defense" x="107" y="40" width="27" height="41" />
<image name="soviet-Infantry" x="107" y="80" width="27" height="41" />
<image name="soviet-Vehicle" x="107" y="120" width="27" height="41" />
<image name="soviet-Plane" x="107" y="160" width="27" height="41" />
<image name="soviet-Ship" x="107" y="200" width="27" height="41" />
</collection> </collection>
<collection name="tabs-2" src="specialbin.png"> <collection name="tabs-normal" src="tabs.png">
<image name="0" x="431" y="64" width="27" height="40" /> <image name="allies-Building" x="54" y="0" width="27" height="41" />
<image name="1" x="431" y="104" width="27" height="40" /> <image name="allies-Defense" x="54" y="40" width="27" height="41" />
<image name="2" x="431" y="144" width="27" height="40" /> <image name="allies-Infantry" x="54" y="80" width="27" height="41" />
<image name="3" x="431" y="184" width="27" height="40" /> <image name="allies-Vehicle" x="54" y="120" width="27" height="41" />
<image name="4" x="431" y="224" width="27" height="40" /> <image name="allies-Plane" x="54" y="160" width="27" height="41" />
<image name="5" x="431" y="264" width="27" height="40" /> <image name="allies-Ship" x="54" y="200" width="27" height="41" />
<image name="soviet-Building" x="134" y="0" width="27" height="41" />
<image name="soviet-Defense" x="134" y="40" width="27" height="41" />
<image name="soviet-Infantry" x="134" y="80" width="27" height="41" />
<image name="soviet-Vehicle" x="134" y="120" width="27" height="41" />
<image name="soviet-Plane" x="134" y="160" width="27" height="41" />
<image name="soviet-Ship" x="134" y="200" width="27" height="41" />
</collection> </collection>
</chrome> </chrome>