Major reworking of the HUD underpinnings to be more modular and require less code duplication. Also made the Editor HUD movable, but for now it's stuck along the left edge.
[VOID.git] / VOID_HUD.cs
blob:a/VOID_HUD.cs -> blob:b/VOID_HUD.cs
--- a/VOID_HUD.cs
+++ b/VOID_HUD.cs
@@ -41,13 +41,8 @@
 		/*
 		 * Fields
 		 * */
-		[AVOID_SaveValue("leftHUDPos")]
-		protected VOID_SaveValue<Rect> leftHUDPos;
-		[AVOID_SaveValue("rightHUDPos")]
-		protected VOID_SaveValue<Rect> rightHUDPos;
-
-		protected HUDWindow leftWindow;
-		protected HUDWindow rightWindow;
+		protected HUDWindow leftHUD;
+		protected HUDWindow rightHUD;
 
 		/*
 		 * Properties
@@ -58,29 +53,17 @@
 		 * */
 		public VOID_HUD() : base()
 		{
-			this._Name = "Heads-Up Display";
+			this.Name = "Heads-Up Display";
 
 			this.toggleActive = true;
 
-			this.leftWindow = new HUDWindow(this.leftHUDWindow, new Rect(Screen.width * .375f - 300f, 0f, 300f, 90f));
-			this.Windows.Add(this.leftWindow);
+			this.leftHUD = new HUDWindow("leftHUD", this.leftHUDWindow, new Rect(Screen.width * .375f - 300f, 0f, 300f, 90f));
+			this.Windows.Add(this.leftHUD);
 
-			this.leftHUDPos = this.leftWindow.WindowPos;
-
-			this.rightWindow = new HUDWindow(this.rightHUDWindow, new Rect(Screen.width * .625f, 0f, 300f, 90f));
-			this.Windows.Add(this.rightWindow);
-
-			this.rightHUDPos = this.rightWindow.WindowPos;
+			this.rightHUD = new HUDWindow("rightHUD", this.rightHUDWindow, new Rect(Screen.width * .625f, 0f, 300f, 90f));
+			this.Windows.Add(this.rightHUD);
 
 			Tools.PostDebugMessage ("VOID_HUD: Constructed.");
-		}
-
-		public override void DrawGUI()
-		{
-			base.DrawGUI();
-
-			this.leftHUDPos.value = this.leftWindow.WindowPos;
-			this.rightHUDPos.value = this.rightWindow.WindowPos;
 		}
 
 		protected void leftHUDWindow(int id)
@@ -120,7 +103,12 @@
 				leftHUD.Append(string.Intern("-- POWER LOST --"));
 			}
 
-			GUILayout.Label(leftHUD.ToString(), VOID_Styles.labelHud, GUILayout.ExpandWidth(true));
+			GUILayout.Label(
+				leftHUD.ToString(),
+				VOID_Styles.labelHud,
+				GUILayout.ExpandWidth(true),
+				GUILayout.ExpandHeight(true)
+			);
 
 			if (!this.positionsLocked)
 			{
@@ -181,7 +169,12 @@
 			}
 
 
-			GUILayout.Label(rightHUD.ToString(), VOID_Styles.labelHud, GUILayout.ExpandWidth(true));
+			GUILayout.Label(
+				rightHUD.ToString(),
+				VOID_Styles.labelHud,
+				GUILayout.ExpandWidth(true),
+				GUILayout.ExpandHeight(true)
+			);
 
 			if (!this.positionsLocked)
 			{