public override bool Draw()
        {
            if (m_transitionAlpha < 1.0f)
                return false;

            if (MyInput.Static.IsNewKeyPressed(MyKeys.J) && MyFakes.ENABLE_OBJECTIVE_LINE)
            {
                MyHud.ObjectiveLine.AdvanceObjective();
            }

            if (!MyHud.MinimalHud)
            {
                ProfilerShort.Begin("Marker rendering");
                ProfilerShort.Begin("m_markerRender.Draw");
                m_markerRender.Draw();
                ProfilerShort.BeginNextBlock("DrawTexts");
                DrawTexts();
                ProfilerShort.End();
                ProfilerShort.End();
            }

            m_toolbarControl.Visible = !(m_hiddenToolbar || MyHud.MinimalHud);

            Vector2 position = new Vector2(0.99f, 0.75f);
            if (MySession.Static.ControlledEntity is MyShipController) position.Y = 0.65f;
            position = ConvertHudToNormalizedGuiPosition(ref position);
            if (MyVideoSettingsManager.IsTripleHead())
                position.X += 1.0f;

            // TODO: refactor this
            m_blockInfo.Visible = MyHud.BlockInfo.Visible && !MyHud.MinimalHud;
            m_blockInfo.BlockInfo = m_blockInfo.Visible ? MyHud.BlockInfo : null;
            m_blockInfo.Position = position;
            m_blockInfo.OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_BOTTOM;

            m_questlogControl.Visible = MyHud.Questlog.Visible && !MyHud.MinimalHud;
            //m_questlogControl.QuestInfo = MyHud.Questlog;
            //m_questlogControl.RecreateControls();
            //m_questlogControl.Position = GetRealPositionOnCenterScreen(Vector2.Zero);
            //m_questlogControl.OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP;

            m_rotatingWheelControl.Visible = MyHud.RotatingWheelVisible && !MyHud.MinimalHud;

            m_chatControl.Visible = !(MyScreenManager.GetScreenWithFocus() is MyGuiScreenScenarioMpBase) && (!MyHud.MinimalHud || m_chatControl.HasFocus);

            if (!base.Draw())
                return false;

            var bgPos = new Vector2(0.01f, 0.85f);
            bgPos = MyGuiScreenHudBase.ConvertHudToNormalizedGuiPosition(ref bgPos);
            m_chatControl.Position = bgPos + new Vector2(0.17f, 0);
            m_chatControl.TextScale = 0.9f;

            bgPos = new Vector2(0.03f, 0.1f);
            bgPos = MyGuiScreenHudBase.ConvertHudToNormalizedGuiPosition(ref bgPos);
            m_cameraInfoMultilineControl.Position = bgPos;
            m_cameraInfoMultilineControl.TextScale = 0.9f;

            if (!MyHud.MinimalHud)
            {
                bool inNaturalGravity = false;
                var cockpit = MySession.Static.ControlledEntity as MyCockpit;
                if (cockpit != null)
                {
                    var characterPosition = cockpit.PositionComp.GetPosition();
                    inNaturalGravity = MyGravityProviderSystem.CalculateHighestNaturalGravityMultiplierInPoint(characterPosition) != 0;
                }

                if (inNaturalGravity)
                    DrawArtificialHorizonAndAltitude();
            }

            MyHud.Notifications.Draw();

            if (!MyHud.MinimalHud)
            {
                m_buildModeLabel.Visible = MyHud.IsBuildMode;

                m_blocksLeft.Text = MyHud.BlocksLeft.GetStringBuilder().ToString();
                m_blocksLeft.Visible = MyHud.BlocksLeft.Visible;

                if (MyHud.ShipInfo.Visible)
                    DrawShipInfo(MyHud.ShipInfo);

                if (MyHud.CharacterInfo.Visible)
                    DrawSuitInfo(MyHud.CharacterInfo);

                if (MyHud.ObjectiveLine.Visible && MyFakes.ENABLE_OBJECTIVE_LINE)
                    DrawObjectiveLine(MyHud.ObjectiveLine);

                if (MySandboxGame.Config.EnablePerformanceWarnings)
                {
                    foreach (var warning in MySimpleProfiler.CurrentWarnings)
                    {
                        if (warning.Value.Time < 120)
                        {
                            DrawPerformanceWarning();
                            break;
                        }
                    }
                }
            }
            else
            {
                m_buildModeLabel.Visible = false;
                m_blocksLeft.Visible = false;
            }

            MyHud.BlockInfo.Visible = false;
            m_blockInfo.BlockInfo = null;

            if (MyFakes.ENABLE_USE_OBJECT_HIGHLIGHT)
            {
                MyHudObjectHighlightStyleData data = new MyHudObjectHighlightStyleData();
                data.AtlasTexture = m_atlas;
                data.TextureCoord = GetTextureCoord(MyHudTexturesEnum.corner);
                MyGuiScreenHudBase.HandleSelectedObjectHighlight(MyHud.SelectedObjectHighlight, data);
            }

            if (!MyHud.MinimalHud)
            {
                if (MyHud.GravityIndicator.Visible)
                    DrawGravityIndicator(MyHud.GravityIndicator, MyHud.CharacterInfo);

                if (MyHud.SinkGroupInfo.Visible)
                    DrawPowerGroupInfo(MyHud.SinkGroupInfo);

                if (MyHud.LocationMarkers.Visible)
                    m_markerRender.DrawLocationMarkers(MyHud.LocationMarkers);

                if (MyHud.GpsMarkers.Visible && MyFakes.ENABLE_GPS)
                    DrawGpsMarkers(MyHud.GpsMarkers);

                if (MyHud.ButtonPanelMarkers.Visible)
                    DrawButtonPanelMarkers(MyHud.ButtonPanelMarkers);

                if (MyHud.OreMarkers.Visible)
                    DrawOreMarkers(MyHud.OreMarkers);

                if (MyHud.LargeTurretTargets.Visible)
                    DrawLargeTurretTargets(MyHud.LargeTurretTargets);

                DrawWorldBorderIndicator(MyHud.WorldBorderChecker);

                if (MyHud.HackingMarkers.Visible)
                    DrawHackingMarkers(MyHud.HackingMarkers);

                //m_chatControl.Visible = !MyHud.MinimalHud;

            }
                DrawCameraInfo(MyHud.CameraInfo);

            ProfilerShort.Begin("Draw netgraph");
            if (MyFakes.ENABLE_NETGRAPH && MyHud.IsNetgraphVisible)
                DrawNetgraph(MyHud.Netgraph);
            ProfilerShort.End();
            //if (Sync.MultiplayerActive)
            DrawMultiplayerNotifications();

            if (!MyHud.MinimalHud)
            {
                if (MyHud.VoiceChat.Visible)
                    DrawVoiceChat(MyHud.VoiceChat);

                if (MyHud.ScenarioInfo.Visible)
                    DrawScenarioInfo(MyHud.ScenarioInfo);
            }
            return true;
        }
        public static void HandleSelectedObjectHighlight(MyHudSelectedObject selection, MyHudObjectHighlightStyleData? data)
        {
            if (selection.PreviousObject.Instance != null)
                RemoveObjectHighlightInternal(ref selection.PreviousObject, true);

            switch (selection.State)
            {
                case MyHudSelectedObjectState.VisibleStateSet:
                {
                    if (selection.Visible && (selection.CurrentObject.Style == MyHudObjectHighlightStyle.DummyHighlight
                            || selection.VisibleRenderID != selection.CurrentObject.Instance.RenderObjectID))
                        MyGuiScreenHudBase.DrawSelectedObjectHighlight(selection, data);

                    break;
                }
                case MyHudSelectedObjectState.MarkedForVisible:
                {
                    MyGuiScreenHudBase.DrawSelectedObjectHighlight(selection, data);
                    break;
                }
                case MyHudSelectedObjectState.MarkedForNotVisible:
                {
                    MyGuiScreenHudBase.RemoveObjectHighlight(selection);
                    break;
                }
            }
        }
        private static void DrawSelectedObjectHighlight(MyHudSelectedObject selection, MyHudObjectHighlightStyleData? data)
        {
            if (selection.InteractiveObject.RenderObjectID == -1)
            {
                // Invalid render object ID
                return;
            }

            switch (selection.HighlightStyle)
            {
                case MyHudObjectHighlightStyle.DummyHighlight:
                {
                    DrawSelectedObjectHighlightDummy(selection, data.Value.AtlasTexture, data.Value.TextureCoord);
                    break;
                }
                case MyHudObjectHighlightStyle.OutlineHighlight:
                {
                    int[] sectionIndices = selection.SectionIndices;
                    if (sectionIndices != null && selection.SectionIndices.Length == 0
                        && selection.SubpartIndices == null)
                    {
                        // There was a problem with sections look-up, fallback to previous highlight style
                        DrawSelectedObjectHighlightDummy(selection, data.Value.AtlasTexture, data.Value.TextureCoord);
                    }
                    else
                    {
                        DrawSelectedObjectHighlightOutline(selection);
                    }
                    break;
                }
                case MyHudObjectHighlightStyle.None:
                {
                    return;
                }
                default:
                    throw new Exception("Unknown highlight style");
            }

            selection.Visible = true;
        }
        private static void DrawSelectedObjectHighlight(MyHudSelectedObject selection, MyHudObjectHighlightStyleData? data)
        {
            if (selection.InteractiveObject.RenderObjectID == -1)
            {
                // Invalid render object ID
                return;
            }

            switch (selection.HighlightStyle)
            {
                case MyHudObjectHighlightStyle.HighlightStyle1:
                {
                    DrawSelectedObjectHighlight1(selection, data.Value.AtlasTexture, data.Value.TextureCoord);
                    break;
                }
                case MyHudObjectHighlightStyle.HighlightStyle2:
                {
                    int[] sectionIndices = selection.SectionIndices;
                    if (sectionIndices != null && selection.SectionIndices.Length == 0)
                    {
                        // There was a problem with sections look-up, fallback to previous highlight style
                        DrawSelectedObjectHighlight1(selection, data.Value.AtlasTexture, data.Value.TextureCoord);
                        break;
                    }

                    DrawSelectedObjectHighlight2(selection);
                    break;
                }
            }

            selection.Visible = true;
        }