diff --git a/OpenRA.Mods.Cnc/OpenRA.Mods.Cnc.csproj b/OpenRA.Mods.Cnc/OpenRA.Mods.Cnc.csproj
index 390e5ab1dd..46a92c10b9 100644
--- a/OpenRA.Mods.Cnc/OpenRA.Mods.Cnc.csproj
+++ b/OpenRA.Mods.Cnc/OpenRA.Mods.Cnc.csproj
@@ -90,6 +90,7 @@
+
diff --git a/OpenRA.Mods.Cnc/Widgets/PowerBarWidget.cs b/OpenRA.Mods.Cnc/Widgets/PowerBarWidget.cs
new file mode 100755
index 0000000000..ddc6e84468
--- /dev/null
+++ b/OpenRA.Mods.Cnc/Widgets/PowerBarWidget.cs
@@ -0,0 +1,65 @@
+#region Copyright & License Information
+/*
+ * Copyright 2007-2011 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.Drawing;
+using OpenRA.Graphics;
+using OpenRA.Mods.RA.Buildings;
+using OpenRA.Widgets;
+
+namespace OpenRA.Mods.RA.Widgets
+{
+ public class PowerBarWidget : Widget
+ {
+ float? lastProvidedFrac;
+ float? lastDrainedFrac;
+
+ readonly PowerManager pm;
+ [ObjectCreator.UseCtor]
+ public PowerBarWidget( [ObjectCreator.Param] World world )
+ {
+ pm = world.LocalPlayer.PlayerActor.Trait();
+ }
+
+ public override void DrawInner()
+ {
+ float powerScaleBy = 100;
+ var maxPower = Math.Max(pm.PowerProvided, pm.PowerDrained);
+ while (maxPower >= powerScaleBy) powerScaleBy *= 2;
+
+ // Current power supply
+ var providedFrac = pm.PowerProvided / powerScaleBy;
+ lastProvidedFrac = providedFrac = float2.Lerp(lastProvidedFrac.GetValueOrDefault(providedFrac), providedFrac, .3f);
+
+ var color = Color.LimeGreen;
+ if (pm.PowerState == PowerState.Low)
+ color = Color.Orange;
+ if (pm.PowerState == PowerState.Critical)
+ color = Color.Red;
+
+ var b = RenderBounds;
+ var rect = new RectangleF(Game.viewport.Location.X + b.X,
+ Game.viewport.Location.Y + b.Y + (1-providedFrac)*b.Height,
+ (float)b.Width,
+ providedFrac*b.Height);
+ Game.Renderer.LineRenderer.FillRect(rect, color);
+
+ var indicator = ChromeProvider.GetImage("powerbar-bits", "indicator");
+
+ var drainedFrac = pm.PowerDrained / powerScaleBy;
+ lastDrainedFrac = drainedFrac = float2.Lerp(lastDrainedFrac.GetValueOrDefault(drainedFrac), drainedFrac, .3f);
+
+ float2 pos = new float2(b.X + b.Width - indicator.size.X,
+ b.Y + (1-drainedFrac)*b.Height - indicator.size.Y / 2);
+
+ Game.Renderer.RgbaSpriteRenderer.DrawSprite(indicator, pos);
+ }
+ }
+}
diff --git a/artsrc/cnc/chrome.svg b/artsrc/cnc/chrome.svg
index d81725f8a3..2afc174c0a 100644
--- a/artsrc/cnc/chrome.svg
+++ b/artsrc/cnc/chrome.svg
@@ -54,8 +54,8 @@
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
- inkscape:zoom="4.984375"
- inkscape:cx="367.37749"
+ inkscape:zoom="11.313708"
+ inkscape:cx="324.81809"
inkscape:cy="470.28486"
inkscape:document-units="px"
inkscape:current-layer="layer1"
@@ -105,6 +105,14 @@
inkscape:groupmode="layer"
id="layer1"
transform="translate(0,-540.3622)">
+
-
+
+
diff --git a/mods/cnc/chrome.yaml b/mods/cnc/chrome.yaml
index 209b4d74ac..18da0085ee 100644
--- a/mods/cnc/chrome.yaml
+++ b/mods/cnc/chrome.yaml
@@ -380,3 +380,5 @@ strategic: strategic.png
enemy_owned: 32,32,32,32
player_owned: 96,0,32,32
+powerbar-bits: chrome.png
+ indicator: 320,40,11,8
diff --git a/mods/cnc/chrome/ingame.yaml b/mods/cnc/chrome/ingame.yaml
index 4adc3abd07..942691735f 100644
--- a/mods/cnc/chrome/ingame.yaml
+++ b/mods/cnc/chrome/ingame.yaml
@@ -138,6 +138,12 @@ Container@INGAME_ROOT:
Width:10
Height:152
Background:panel-black
+ Children:
+ PowerBar:
+ X:1
+ Y:1
+ Width:PARENT_RIGHT-2
+ Height:PARENT_BOTTOM-2
Label@POWERICON:
X:10
Y:170
diff --git a/mods/cnc/uibits/chrome.png b/mods/cnc/uibits/chrome.png
index 06f6b499e0..252c1fd995 100644
Binary files a/mods/cnc/uibits/chrome.png and b/mods/cnc/uibits/chrome.png differ