Added GUI stuff from base Core. Working on relocating the icon which isn't working for who knows why. editordev
Added GUI stuff from base Core. Working on relocating the icon which isn't working for who knows why.

--- a/VOID.csproj
+++ b/VOID.csproj
@@ -33,6 +33,11 @@
     <WarningLevel>4</WarningLevel>
     <ConsolePause>false</ConsolePause>
     <DefineConstants>TRACE</DefineConstants>
+    <CustomCommands>
+      <CustomCommands>
+        <Command type="AfterBuild" command="/usr/bin/cp -fv ${ProjectDir}/bin/Release/VOID.dll /mnt/games/ssd/KSP_linux/GameData/VOID/Plugins/" />
+      </CustomCommands>
+    </CustomCommands>
   </PropertyGroup>
   <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
   <ItemGroup>

--- a/VOIDFlightMaster.cs
+++ b/VOIDFlightMaster.cs
@@ -54,6 +54,13 @@
 
 		public void Update()
 		{
+			if (!HighLogic.LoadedSceneIsEditor)
+			{
+				this.Core = null;
+				VOID_Core.Reset();
+				return;
+			}
+
 			if (this.Core == null)
 			{
 				this.Awake();
@@ -77,12 +84,22 @@
 
 		public void FixedUpdate()
 		{
+			if (this.Core == null || !HighLogic.LoadedSceneIsFlight)
+			{
+				return;
+			}
+
+			this.Core.FixedUpdate ();
+		}
+
+		public void OnGUI()
+		{
 			if (this.Core == null)
 			{
 				return;
 			}
 
-			this.Core.FixedUpdate ();
+			this.Core.OnGUI();
 		}
     }
 
@@ -101,18 +118,19 @@
 
 		public void Update()
 		{
+			if (!HighLogic.LoadedSceneIsEditor)
+			{
+				this.Core = null;
+				VOID_EditorCore.Reset();
+				return;
+			}
+
 			if (this.Core == null)
 			{
 				this.Awake();
 			}
 
 			this.Core.Update ();
-
-			if (this.Core.vessel != null)
-			{
-				SimManager.Instance.Gravity = this.Core.vessel.mainBody.gravParameter / Math.Pow(this.Core.vessel.mainBody.Radius, 2);
-				SimManager.Instance.TryStartSimulation();
-			}
 
 			if (this.Core.factoryReset)
 			{
@@ -124,13 +142,23 @@
 
 		public void FixedUpdate()
 		{
-			if (this.Core == null)
+			if (this.Core == null || !HighLogic.LoadedSceneIsEditor)
 			{
 				return;
 			}
 
 			this.Core.FixedUpdate ();
 		}
+
+		public void OnGUI()
+		{
+			if (this.Core == null)
+			{
+				return;
+			}
+
+			this.Core.OnGUI();
+		}
 	}
 }
 

--- a/VOID_Core.cs
+++ b/VOID_Core.cs
@@ -97,6 +97,7 @@
 		protected Texture2D VOIDIconTexture;
 		protected string VOIDIconOnPath = "VOID/Textures/void_icon_on";
 		protected string VOIDIconOffPath = "VOID/Textures/void_icon_off";
+		protected bool VOIDIconLocked = true;
 
 		protected int windowBaseID = -96518722;
 		protected int _windowID = 0;
@@ -471,6 +472,8 @@
 		{
 			this.consumeResource = GUILayout.Toggle (this.consumeResource, "Consume Resources");
 
+			this.VOIDIconLocked = GUILayout.Toggle (this.VOIDIconLocked, "Lock Icon Position");
+
 			GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
 
 			GUILayout.Label("Skin:", GUILayout.ExpandWidth(false));
@@ -510,6 +513,54 @@
 			this._factoryReset = GUILayout.Toggle (this._factoryReset, "Factory Reset");
 		}
 
+		public void OnGUI()
+		{
+			if (Event.current.type == EventType.Layout || Event.current.type == EventType.Repaint)
+			{
+				return;
+			}
+
+			Tools.PostDebugMessage(string.Format(
+				"Event.current.type: {0}" +
+				"this.VOIDIconLocked: {1}" +
+				"Event.current.mousePosition: {2}",
+				Event.current.type,
+				this.VOIDIconLocked,
+				Event.current.mousePosition
+				));
+
+			if (!this.VOIDIconLocked &&
+			    VOIDIconPos.value.Contains(Event.current.mousePosition)
+			    && Event.current.type == EventType.mouseDrag
+			    )
+			{
+				Tools.PostDebugMessage(string.Format(
+					"Event.current.type: {0}" +
+					"\ndelta.x: {1}; delta.y: {2}",
+					Event.current.type,
+					Event.current.delta.x,
+					Event.current.delta.y
+				));
+
+				Rect tmp = new Rect(VOIDIconPos);
+
+				tmp.x = Event.current.mousePosition.x - tmp.width / 2;
+				tmp.y = Event.current.mousePosition.y - tmp.height / 2;
+
+				if (tmp.x > Screen.width - tmp.width)
+				{
+					tmp.x = Screen.width - tmp.width;
+				}
+
+				if (tmp.y > Screen.height - tmp.height)
+				{
+					tmp.y = Screen.height - tmp.height;
+				}
+
+				VOIDIconPos = tmp;
+			}
+		}
+
 		public override void DrawGUI()
 		{
 			if (!this._modulesLoaded)
@@ -533,7 +584,7 @@
 
 			this.VOIDIconTexture = this.VOIDIconOff;  //icon off default
 			if (this.togglePower) this.VOIDIconTexture = this.VOIDIconOn;     //or on if power_toggle==true
-			if (GUI.Button(new Rect(VOIDIconPos), VOIDIconTexture, new GUIStyle()))
+			if (GUI.Button(VOIDIconPos, VOIDIconTexture, new GUIStyle()) && this.VOIDIconLocked)
 			{
 				this.mainGuiMinimized = !this.mainGuiMinimized;
 			}

--- a/VOID_EditorCore.cs
+++ b/VOID_EditorCore.cs
@@ -18,6 +18,7 @@
 //
 //  You should have received a copy of the GNU General Public License
 //  along with this program.  If not, see <http://www.gnu.org/licenses/>.
+using Engineer.VesselSimulator;
 using KSP;
 using System;
 using System.Collections.Generic;
@@ -56,14 +57,19 @@
 
 		public new static void Reset()
 		{
-			_instance.StopGUI();
-			_instance = null;
-			_initialized = false;
+			if (_initialized)
+			{
+				_instance.StopGUI();
+				_instance = null;
+				_initialized = false;
+			}
 		}
 
 		public VOID_EditorCore() : base()
 		{
 			this._Name = "VOID Editor Core";
+
+			this.VOIDIconPos = new Rect(Screen.width - 60, Screen.height - 30, 30, 30);
 		}
 
 		public override void DrawGUI()
@@ -72,20 +78,43 @@
 			{
 				this.LoadModulesOfType<IVOID_EditorModule>();
 			}
+
+			base.DrawGUI();
 		}
 
 		public new void Update()
 		{
 			foreach (IVOID_EditorModule module in this.Modules)
 			{
-				if (HighLogic.LoadedSceneIsEditor && module.toggleActive)
+				if (EditorLogic.startPod == null)
+				{
+					module.StopGUI();
+					continue;
+				}
+				if (HighLogic.LoadedSceneIsEditor && module.toggleActive && EditorLogic.SortedShipList.Any())
 				{
 					module.StartGUI();
 				}
-				if (!HighLogic.LoadedSceneIsEditor || !module.toggleActive)
+				if (!HighLogic.LoadedSceneIsEditor || !module.toggleActive || !EditorLogic.SortedShipList.Any())
 				{
 					module.StopGUI();
 				}
+			}
+
+			if (EditorLogic.startPod == null)
+			{
+				this.StopGUI();
+				return;
+			}
+			else if (!this.guiRunning)
+			{
+				this.StartGUI();
+			}
+
+			if (EditorLogic.SortedShipList.Count > 0)
+			{
+				SimManager.Instance.Gravity = 9.08665;
+				SimManager.Instance.TryStartSimulation();
 			}
 		}
 

--- a/VOID_EditorHUD.cs
+++ b/VOID_EditorHUD.cs
@@ -20,10 +20,11 @@
 //  along with this program.  If not, see <http://www.gnu.org/licenses/>.
 //
 
+using Engineer.VesselSimulator;
 using KSP;
-using UnityEngine;
 using System;
 using System.Collections.Generic;
+using UnityEngine;
 
 namespace VOID
 {
@@ -80,6 +81,7 @@
 			this.textColors.Add(Color.magenta);
 
 			this.labelStyle = new GUIStyle ();
+			this.labelStyle.alignment = TextAnchor.UpperRight;
 			this.labelStyle.normal.textColor = this.textColors [this.ColorIndex];
 
 			Tools.PostDebugMessage (this.GetType().Name + ": Constructed.");
@@ -87,13 +89,24 @@
 
 		public override void DrawGUI()
 		{
-			GUI.skin = AssetBase.GetGUISkin("KSP window 2");
+			SimManager.Instance.RequestSimulation();
+
+			if (SimManager.Instance.LastStage == null)
+			{
+				return;
+			}
+
+			// GUI.skin = AssetBase.GetGUISkin("KSP window 2");
 
 			labelStyle.normal.textColor = textColors [ColorIndex];
 
 			GUI.Label (
-				new Rect (Screen.width - 310, 80, 300f, 90f),
-				"Sample HUD Line 1\nSample HUD Line 2\nSample HUD Line 3\nSample HUD Line 4\n",
+				new Rect (Screen.width - 310, 80, 300f, 32f),
+				"Total Mass: " + SimManager.Instance.LastStage.totalMass.ToString("F3") + "t" +
+				" Part Count: " + EditorLogic.SortedShipList.Count +
+				"\nTotal Delta-V: " + Tools.MuMech_ToSI(SimManager.Instance.LastStage.totalDeltaV) + "m/s" +
+				"\nBottom Stage Delta-V: " + Tools.MuMech_ToSI(SimManager.Instance.LastStage.deltaV) + "m/s" +
+				"\nBottom Stage T/W Ratio: " + SimManager.Instance.LastStage.thrustToWeight.ToString("F3"),
 				labelStyle);
 		}
 

--- a/VOID_Module.cs
+++ b/VOID_Module.cs
@@ -81,7 +81,7 @@
 		 * */
 		public void StartGUI()
 		{
-			if (!this.toggleActive)
+			if (!this.toggleActive || this.guiRunning)
 			{
 				return;
 			}
@@ -93,6 +93,10 @@
 
 		public void StopGUI()
 		{
+			if (!this.guiRunning)
+			{
+				return;
+			}
 			Tools.PostDebugMessage (string.Format("Removing {0} from the draw queue.", this.GetType().Name));
 			RenderingManager.RemoveFromPostDrawQueue (3, this.DrawGUI);
 			this._Running = false;