Пример #1
0
        private void DrawSuitInfo(MyHudCharacterInfo suitInfo)
        {
            MyGuiDrawAlignEnum align = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_BOTTOM;
            Color              color = Color.White;
            var                basePos = new Vector2(0.01f, 0.99f);
            var                bgPos = ConvertHudToNormalizedGuiPosition(ref basePos);
            Vector2            namePos, valuePos, bgScale;
            MyGuiPaddedTexture bg;

            bg      = MyGuiConstants.TEXTURE_HUD_BG_MEDIUM_DEFAULT;
            bgScale = new Vector2(1.1f, 1f);
            MyGuiManager.DrawSpriteBatch(bg.Texture, bgPos, new Vector2(bg.SizeGui.X * bgScale.X, suitInfo.Data.GetGuiHeight()), Color.White, align);

            namePos  = bgPos + new Vector2(1f, -1f) * bg.PaddingSizeGui * bgScale;
            valuePos = bgPos + bgScale * (new Vector2(bg.SizeGui.X, 0f) - bg.PaddingSizeGui);

            suitInfo.Data.DrawBottomUp(namePos, valuePos, m_textScale);
        }
Пример #2
0
        private void DrawSuitInfo(MyHudCharacterInfo suitInfo)
        {
            MyGuiDrawAlignEnum align = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_BOTTOM;
            Color color = Color.White;
            var basePos = new Vector2(0.01f, 0.99f);
            var bgPos = ConvertHudToNormalizedGuiPosition(ref basePos);
            Vector2 namePos, valuePos, bgScale;
            MyGuiPaddedTexture bg;

            bg = MyGuiConstants.TEXTURE_HUD_BG_MEDIUM_DEFAULT;
            bgScale = new Vector2(1.1f, 1f);
            var bgWidth = (!MyHud.ShipInfo.Visible || MyUtils.IsZero(m_gravityHudWidth)) ? bg.SizeGui.X * bgScale.X : m_gravityHudWidth;
            MyGuiManager.DrawSpriteBatch(bg.Texture, bgPos, new Vector2(bgWidth, suitInfo.Data.GetGuiHeight()), Color.White, align);

            namePos = bgPos + new Vector2(1f, -1f) * bg.PaddingSizeGui * bgScale;
            valuePos = bgPos + (new Vector2(bgWidth, 0f) - bg.PaddingSizeGui);

            suitInfo.Data.DrawBottomUp(namePos, valuePos, m_textScale);
        }
Пример #3
0
        private void DrawGravityIndicator(MyHudGravityIndicator indicator, MyHudCharacterInfo characterInfo)
        {
            if (indicator.Entity == null)
                return;

            Vector3D worldPosition = MySession.Static.GetCameraControllerEnum() == MyCameraControllerEnum.Entity || MySession.Static.GetCameraControllerEnum() == MyCameraControllerEnum.ThirdPersonSpectator ? indicator.Entity.PositionComp.WorldAABB.Center : MySpectatorCameraController.Static.Position;
            Vector3 totalGravity = MyGravityProviderSystem.CalculateTotalGravityInPoint(worldPosition);
            Vector3 naturalGravity = MyGravityProviderSystem.CalculateNaturalGravityInPoint(worldPosition);
            Vector3 artificialGravity = totalGravity - naturalGravity;
            //gravity += MyPhysics.HavokWorld.Gravity;
            bool anyGravity = !Vector3.IsZero(totalGravity);
            bool anyNaturalGravity = anyGravity && !Vector3.IsZero(naturalGravity);

            // Background and text drawing
            string totalGravityFont, artificialGravityFont = MyFontEnum.Blue, naturalGravityFont = MyFontEnum.Blue;
            StringBuilder totalGravityText, artificialGravityText = null, naturalGravityText = null;
            MyGuiPaddedTexture backgroundTexture;
            if (anyGravity)
            {
                totalGravityFont = MyFontEnum.Blue;
                totalGravityText = MyTexts.Get(MySpaceTexts.HudInfoGravity);
                if (!anyNaturalGravity)
                    artificialGravityFont = MyFontEnum.White;
                artificialGravityText = MyTexts.Get(MySpaceTexts.HudInfoGravityArtificial);
                backgroundTexture = MyGuiConstants.TEXTURE_HUD_BG_MEDIUM_DEFAULT;
            }
            else
            {
                totalGravityFont = MyFontEnum.Red;
                totalGravityText = MyTexts.Get(MySpaceTexts.HudInfoNoGravity);
                backgroundTexture = MyGuiConstants.TEXTURE_HUD_BG_MEDIUM_RED;
            }

            if (anyNaturalGravity)
            {
                naturalGravityText = MyTexts.Get(MySpaceTexts.HudInfoGravityNatural);
                if (naturalGravity.Length() > artificialGravity.Length())
                {
                    artificialGravityFont = MyFontEnum.Blue;
                    naturalGravityFont = MyFontEnum.White;
                }
                else
                {
                    artificialGravityFont = MyFontEnum.White;
                    naturalGravityFont = MyFontEnum.Blue;
                }
            }

            bool drawOxygen = MySession.Static.Settings.EnableOxygen;
            Vector2 bgSizeDelta = new Vector2(0.015f + 0.02f, 0.05f);
            float oxygenLevel = 0f;

            Vector2 oxygenCompensation = Vector2.Zero;
            if (drawOxygen && anyNaturalGravity) oxygenCompensation = new Vector2(0f, 0.025f);
            Vector2 backgroundSize = backgroundTexture.SizeGui + bgSizeDelta + oxygenCompensation;

            Vector2 backgroundPosition, vectorPosition;
            Vector2 totalGravityTextPos, artificialGravityTextPos, naturalGravityTextPos;
            Vector2 totalGravityNumberPos, artificialGravityNumberPos, naturalGravityNumberPos;
            Vector2 dividerLinePosition, dividerLineSize;
            MyGuiDrawAlignEnum backgroundAlignment, gravityTextAlignment = MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_TOP, gravityNumberAlignment = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP;

            dividerLineSize = new Vector2(backgroundSize.X - backgroundTexture.PaddingSizeGui.X * 1f, backgroundSize.Y / 60f);

            if (indicator.Entity is MyCharacter)
            {
                backgroundAlignment = MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_BOTTOM;
                backgroundPosition = new Vector2(0.99f, 0.99f);
                backgroundPosition = ConvertHudToNormalizedGuiPosition(ref backgroundPosition);

                totalGravityTextPos = backgroundPosition - backgroundSize * new Vector2(0.35f, 1.075f);
                totalGravityNumberPos = totalGravityTextPos + new Vector2(0.0075f, 0.002f);
                dividerLinePosition = new Vector2(backgroundPosition.X - backgroundSize.X + backgroundTexture.PaddingSizeGui.X / 2.0f, totalGravityTextPos.Y) + new Vector2(0.0f, 0.026f);


                {
                    artificialGravityTextPos = new Vector2(totalGravityTextPos.X, dividerLinePosition.Y) + new Vector2(0.0f, 0.005f);
                    artificialGravityNumberPos = new Vector2(totalGravityNumberPos.X, artificialGravityTextPos.Y);
                    naturalGravityTextPos = artificialGravityTextPos + new Vector2(0.0f, 0.025f);
                    naturalGravityNumberPos = artificialGravityNumberPos + new Vector2(0.0f, 0.025f);
                }

                vectorPosition = backgroundPosition - backgroundSize * new Vector2(0.5f, 0.5f - 0.05f) + backgroundTexture.PaddingSizeGui * Vector2.UnitY * 0.5f;

                oxygenLevel = (indicator.Entity as MyCharacter).OxygenComponent != null ? (indicator.Entity as MyCharacter).OxygenComponent.EnvironmentOxygenLevel : 0f;
            }
            else
            {
                backgroundAlignment = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_BOTTOM;
                backgroundPosition = new Vector2(0.01f, 1f - (characterInfo.Data.GetGuiHeight() + 0.02f));
                backgroundPosition = ConvertHudToNormalizedGuiPosition(ref backgroundPosition);

                gravityTextAlignment = MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_BOTTOM;
                gravityNumberAlignment = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_BOTTOM;
                totalGravityTextPos = backgroundPosition + backgroundSize * new Vector2(1 - 0.35f, -0.99f) + backgroundTexture.PaddingSizeGui * Vector2.UnitY * 0.2f;
                totalGravityNumberPos = totalGravityNumberPos = totalGravityTextPos + new Vector2(0.0075f, 0.0025f);
                dividerLinePosition = new Vector2(backgroundPosition.X + backgroundTexture.PaddingSizeGui.X / 2.0f, totalGravityTextPos.Y - 0.022f) + new Vector2(0.0f, 0.026f);

                {
                    artificialGravityTextPos = new Vector2(totalGravityTextPos.X, dividerLinePosition.Y + 0.023f) + new Vector2(0.0f, 0.005f);
                    artificialGravityNumberPos = new Vector2(totalGravityNumberPos.X, artificialGravityTextPos.Y);
                    naturalGravityTextPos = artificialGravityTextPos + new Vector2(0.0f, 0.025f);
                    naturalGravityNumberPos = artificialGravityNumberPos + new Vector2(0.0f, 0.025f);
                }

                vectorPosition = backgroundPosition - backgroundSize * new Vector2(-0.5f, 0.5f - 0.05f) + backgroundTexture.PaddingSizeGui * Vector2.UnitY * 0.5f;

                var cockpit = indicator.Entity as MyCockpit;
                if (cockpit != null && cockpit.Pilot != null && cockpit.Pilot.OxygenComponent != null)
                {
                    oxygenLevel = cockpit.Pilot.OxygenComponent.EnvironmentOxygenLevel;
                }
                else
                {
                    drawOxygen = false;
                }
            }

            m_gravityHudWidth = backgroundSize.X;
            MyGuiManager.DrawSpriteBatch(backgroundTexture.Texture, backgroundPosition, backgroundSize + (true ? new Vector2(0f, 0.025f) : Vector2.Zero), Color.White, backgroundAlignment);
            var controlledEntity = MySession.Static.ControlledEntity as MyEntity;
            var scale = 0.85f;
            if (anyNaturalGravity && controlledEntity != null)
            {
                double cosRotation = Vector3D.Normalize(Vector3D.Reject(naturalGravity, controlledEntity.WorldMatrix.Forward)).Dot(Vector3D.Normalize(-controlledEntity.WorldMatrix.Up));
                float rotation = 0.0f;
                rotation = (float)Math.Acos(cosRotation);

                if (naturalGravity.Dot(controlledEntity.WorldMatrix.Right) >= 0)
                    rotation = 2.0f * (float)Math.PI - rotation;

                MyGuiManager.DrawSpriteBatch(MyGuiConstants.TEXTURE_HUD_GRAVITY_GLOBE.Texture, vectorPosition + new Vector2(0.045f, 0.065f) * scale + oxygenCompensation / 2, scale, Color.White, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, rotation, new Vector2(0.5f));
            }
            MyGuiManager.DrawString(totalGravityFont, totalGravityText, totalGravityTextPos, m_textScale, drawAlign: gravityTextAlignment);

            if (anyGravity)
                MyGuiManager.DrawSpriteBatch(MyGuiConstants.TEXTURE_HUD_GRAVITY_LINE.Texture, dividerLinePosition, dividerLineSize, Color.White, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER);

            if (drawOxygen)
            {
                Vector2 oxygenTextPos = artificialGravityTextPos + new Vector2(0.0f, 0.025f) + oxygenCompensation.Y;
                var oxygenFont = MyFontEnum.Blue;
                var oxygenText = new StringBuilder(MyTexts.Get(MySpaceTexts.HudInfoOxygen).ToString());
                if (oxygenLevel == 0f)
                {
                    oxygenText.Append("None");
                    oxygenFont = MyFontEnum.Red;
                }
                else if (oxygenLevel < 0.5f)
                {
                    oxygenText.Append("Low");
                    oxygenFont = MyFontEnum.Red;
                }
                else
                {
                    oxygenText.Append("High");
                }

                MyGuiManager.DrawString(oxygenFont, oxygenText, oxygenTextPos, m_textScale, drawAlign: gravityTextAlignment);
            }

            if (anyGravity)
            {
                m_hudIndicatorText.Clear();
                m_hudIndicatorText.AppendFormatedDecimal("", totalGravity.Length() / MyGravityProviderSystem.G, 2, " g");
                MyGuiManager.DrawString(totalGravityFont, m_hudIndicatorText, totalGravityNumberPos, m_textScale, drawAlign: gravityNumberAlignment);
                m_hudIndicatorText.Clear();
                m_hudIndicatorText.AppendFormatedDecimal("", artificialGravity.Length() / MyGravityProviderSystem.G, 2, " g");
                MyGuiManager.DrawString(artificialGravityFont, artificialGravityText, artificialGravityTextPos, m_textScale, drawAlign: gravityTextAlignment);
                MyGuiManager.DrawString(artificialGravityFont, m_hudIndicatorText, artificialGravityNumberPos, m_textScale, drawAlign: gravityNumberAlignment);
                if (anyNaturalGravity)
                {
                    m_hudIndicatorText.Clear();
                    m_hudIndicatorText.AppendFormatedDecimal("", naturalGravity.Length() / MyGravityProviderSystem.G, 2, " g");
                    MyGuiManager.DrawString(naturalGravityFont, naturalGravityText, naturalGravityTextPos, m_textScale, drawAlign: gravityTextAlignment);
                    MyGuiManager.DrawString(naturalGravityFont, m_hudIndicatorText, naturalGravityNumberPos, m_textScale, drawAlign: gravityNumberAlignment);
                }
            }

            vectorPosition = MyGuiManager.GetHudSize() * ConvertNormalizedGuiToHud(ref vectorPosition) + (oxygenCompensation / 2) * scale;
            if (MyVideoSettingsManager.IsTripleHead())
                vectorPosition.X += 1.0f;

            // Draw each of gravity indicators.
            foreach (var generatorGravity in MyGravityProviderSystem.GravityVectors)
                DrawGravityVectorIndicator(vectorPosition, generatorGravity, MyHudTexturesEnum.gravity_arrow, Color.Gray);

            if (anyGravity)
                DrawGravityVectorIndicator(vectorPosition, totalGravity, MyHudTexturesEnum.gravity_arrow, Color.White);

            // Draw center
            MyAtlasTextureCoordinate centerTextCoord;
            if (anyGravity)
                centerTextCoord = GetTextureCoord(MyHudTexturesEnum.gravity_point_white);
            else
                centerTextCoord = GetTextureCoord(MyHudTexturesEnum.gravity_point_red);

            float hudSizeX = MyGuiManager.GetSafeFullscreenRectangle().Width / MyGuiManager.GetHudSize().X;
            float hudSizeY = MyGuiManager.GetSafeFullscreenRectangle().Height / MyGuiManager.GetHudSize().Y;
            Vector2 rightVector = Vector2.UnitX;

            MyRenderProxy.DrawSpriteAtlas(
                m_atlas,
                vectorPosition,
                centerTextCoord.Offset,
                centerTextCoord.Size,
                rightVector,
                new Vector2(hudSizeX, hudSizeY),
                MyHudConstants.HUD_COLOR_LIGHT,
                Vector2.One * 0.005f);

        }
        private void DrawGravityIndicator(MyHudGravityIndicator indicator, MyHudCharacterInfo characterInfo)
        {
            if (indicator.Entity == null)
                return;

            Vector3 gravity = MyGravityProviderSystem.CalculateGravityInPoint(MySession.GetCameraControllerEnum() == MyCameraControllerEnum.Entity || MySession.GetCameraControllerEnum() == MyCameraControllerEnum.ThirdPersonSpectator ? indicator.Entity.PositionComp.WorldAABB.Center : MySpectatorCameraController.Static.Position);
            //gravity += MyPhysics.HavokWorld.Gravity;
            bool anyGravity = !MyUtils.IsZero(gravity.Length());

            // Background and text drawing
            MyFontEnum font;
            StringBuilder text;
            m_hudIndicatorText.Clear();
            m_hudIndicatorText.AppendFormatedDecimal("", gravity.Length() / 9.81f, 1, " g");
            MyGuiPaddedTexture bg;
            if (anyGravity)
            {
                font = MyFontEnum.Blue;
                text = MyTexts.Get(MySpaceTexts.HudInfoGravity);
                bg = MyGuiConstants.TEXTURE_HUD_BG_MEDIUM_DEFAULT;
            }
            else
            {
                font = MyFontEnum.Red;
                text = MyTexts.Get(MySpaceTexts.HudInfoNoGravity);
                bg = MyGuiConstants.TEXTURE_HUD_BG_MEDIUM_RED;
            }

            bool drawOxygen = MySession.Static.Settings.EnableOxygen;
            Vector2 bgSizeDelta = new Vector2(0.015f, 0f);
            float oxygenLevel = 0f;

            Vector2 bgSize = bg.SizeGui + bgSizeDelta;

            Vector2 bgPos, textPos, gTextPos, position;
            MyGuiDrawAlignEnum align;
            if (indicator.Entity is MyCharacter)
            {
                bgPos = new Vector2(0.99f, 0.99f);
                bgPos = ConvertHudToNormalizedGuiPosition(ref bgPos);
                textPos = bgPos - bgSize * new Vector2(0.94f, 0.98f) + bg.PaddingSizeGui * Vector2.UnitY * 0.2f;
                gTextPos = bgPos - bgSize * new Vector2(0.56f, 0.98f) + bg.PaddingSizeGui * Vector2.UnitY * 0.2f;
                align = MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_BOTTOM;
                position = bgPos - bgSize * new Vector2(0.5f, 0.5f) + bg.PaddingSizeGui * Vector2.UnitY * 0.5f;

                oxygenLevel = (indicator.Entity as MyCharacter).EnvironmentOxygenLevel;
            }
            else
            {
                bgPos = new Vector2(0.01f, 1f - (characterInfo.Data.GetGuiHeight() + 0.02f));
                bgPos = ConvertHudToNormalizedGuiPosition(ref bgPos);
                textPos = bgPos + bgSize * new Vector2(1 - 0.94f, -0.98f) + bg.PaddingSizeGui * Vector2.UnitY * 0.2f;
                gTextPos = bgPos + bgSize * new Vector2(1 - 0.56f, -0.98f) + bg.PaddingSizeGui * Vector2.UnitY * 0.2f;
                align = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_BOTTOM;
                position = bgPos - bgSize * new Vector2(-0.5f, 0.5f) + bg.PaddingSizeGui * Vector2.UnitY * 0.5f;

                var cockpit = indicator.Entity as MyCockpit;
                if (cockpit != null && cockpit.Pilot != null)
                {
                    oxygenLevel = cockpit.Pilot.EnvironmentOxygenLevel;
                }
                else
                {
                    drawOxygen = false;
                }
            }

            if (drawOxygen)
            {
                bgSizeDelta += new Vector2(0f, 0.025f);
            }

            MyGuiManager.DrawSpriteBatch(bg.Texture, bgPos, bg.SizeGui + bgSizeDelta, Color.White, align);

            MyGuiManager.DrawString(font, text, textPos, m_textScale);

            if (drawOxygen)
            {
                var oxygenFont = MyFontEnum.Blue;
                var oxygenText = new StringBuilder("Oxygen: ");
                if (oxygenLevel == 0f)
                {
                    oxygenText.Append("None");
                    oxygenFont = MyFontEnum.Red;
                }
                else if (oxygenLevel < 0.5f)
                {
                    oxygenText.Append("Low");
                    oxygenFont = MyFontEnum.Red;
                }
                else
                {
                    oxygenText.Append("High");
                }
                
                MyGuiManager.DrawString(oxygenFont, oxygenText, textPos - new Vector2(0f, 0.025f), m_textScale);
            }

            if (anyGravity)
                MyGuiManager.DrawString(MyFontEnum.White, m_hudIndicatorText, gTextPos, m_textScale);

            position = MyGuiManager.GetHudSize() * ConvertNormalizedGuiToHud(ref position);
            if (MyVideoSettingsManager.IsTripleHead())
                position.X += 1.0f;

            // Draw each of gravity indicators.
            foreach (var generatorGravity in MyGravityProviderSystem.GravityVectors)
                DrawGravityVectorIndicator(position, generatorGravity, MyHudTexturesEnum.gravity_arrow, Color.Gray);

            //if (MyPhysics.HavokWorld.Gravity != Vector3.Zero)
            //    DrawGravityVectorIndicator(position, MyPhysics.HavokWorld.Gravity, MyHudTexturesEnum.gravity_arrow, Color.Gray);

            if (anyGravity)
                DrawGravityVectorIndicator(position, gravity, MyHudTexturesEnum.gravity_arrow, Color.White);

            // Draw center
            MyAtlasTextureCoordinate centerTextCoord;
            if (anyGravity)
                centerTextCoord = GetTextureCoord(MyHudTexturesEnum.gravity_point_white);
            else
                centerTextCoord = GetTextureCoord(MyHudTexturesEnum.gravity_point_red);

            float hudSizeX = MyGuiManager.GetSafeFullscreenRectangle().Width / MyGuiManager.GetHudSize().X;
            float hudSizeY = MyGuiManager.GetSafeFullscreenRectangle().Height / MyGuiManager.GetHudSize().Y;
            Vector2 rightVector = Vector2.UnitX;

            MyRenderProxy.DrawSpriteAtlas(
                m_atlas,
                position,
                centerTextCoord.Offset,
                centerTextCoord.Size,
                rightVector,
                new Vector2(hudSizeX, hudSizeY),
                MyHudConstants.HUD_COLOR_LIGHT,
                Vector2.One * 0.005f);

        }
Пример #5
0
        private void DrawGravityIndicator(MyHudGravityIndicator indicator, MyHudCharacterInfo characterInfo)
        {
            if (indicator.Entity == null)
            {
                return;
            }

            Vector3 gravity = MyGravityProviderSystem.CalculateGravityInPoint(MySession.GetCameraControllerEnum() == MyCameraControllerEnum.Entity || MySession.GetCameraControllerEnum() == MyCameraControllerEnum.ThirdPersonSpectator ? indicator.Entity.PositionComp.WorldAABB.Center : MySpectatorCameraController.Static.Position);
            //gravity += MyPhysics.HavokWorld.Gravity;
            bool anyGravity = !MyUtils.IsZero(gravity.Length());

            // Background and text drawing
            MyFontEnum    font;
            StringBuilder text;

            m_hudIndicatorText.Clear();
            m_hudIndicatorText.AppendFormatedDecimal("", gravity.Length() / 9.81f, 1, " g");
            MyGuiPaddedTexture bg;

            if (anyGravity)
            {
                font = MyFontEnum.Blue;
                text = MyTexts.Get(MySpaceTexts.HudInfoGravity);
                bg   = MyGuiConstants.TEXTURE_HUD_BG_MEDIUM_DEFAULT;
            }
            else
            {
                font = MyFontEnum.Red;
                text = MyTexts.Get(MySpaceTexts.HudInfoNoGravity);
                bg   = MyGuiConstants.TEXTURE_HUD_BG_MEDIUM_RED;
            }

            bool    drawOxygen  = MySession.Static.Settings.EnableOxygen;
            Vector2 bgSizeDelta = new Vector2(0.015f, 0f);
            float   oxygenLevel = 0f;

            Vector2 bgSize = bg.SizeGui + bgSizeDelta;

            Vector2            bgPos, textPos, gTextPos, position;
            MyGuiDrawAlignEnum align;

            if (indicator.Entity is MyCharacter)
            {
                bgPos    = new Vector2(0.99f, 0.99f);
                bgPos    = ConvertHudToNormalizedGuiPosition(ref bgPos);
                textPos  = bgPos - bgSize * new Vector2(0.94f, 0.98f) + bg.PaddingSizeGui * Vector2.UnitY * 0.2f;
                gTextPos = bgPos - bgSize * new Vector2(0.56f, 0.98f) + bg.PaddingSizeGui * Vector2.UnitY * 0.2f;
                align    = MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_BOTTOM;
                position = bgPos - bgSize * new Vector2(0.5f, 0.5f) + bg.PaddingSizeGui * Vector2.UnitY * 0.5f;

                oxygenLevel = (indicator.Entity as MyCharacter).EnvironmentOxygenLevel;
            }
            else
            {
                bgPos    = new Vector2(0.01f, 1f - (characterInfo.Data.GetGuiHeight() + 0.02f));
                bgPos    = ConvertHudToNormalizedGuiPosition(ref bgPos);
                textPos  = bgPos + bgSize * new Vector2(1 - 0.94f, -0.98f) + bg.PaddingSizeGui * Vector2.UnitY * 0.2f;
                gTextPos = bgPos + bgSize * new Vector2(1 - 0.56f, -0.98f) + bg.PaddingSizeGui * Vector2.UnitY * 0.2f;
                align    = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_BOTTOM;
                position = bgPos - bgSize * new Vector2(-0.5f, 0.5f) + bg.PaddingSizeGui * Vector2.UnitY * 0.5f;

                var cockpit = indicator.Entity as MyCockpit;
                if (cockpit != null && cockpit.Pilot != null)
                {
                    oxygenLevel = cockpit.Pilot.EnvironmentOxygenLevel;
                }
                else
                {
                    drawOxygen = false;
                }
            }

            if (drawOxygen)
            {
                bgSizeDelta += new Vector2(0f, 0.025f);
            }

            MyGuiManager.DrawSpriteBatch(bg.Texture, bgPos, bg.SizeGui + bgSizeDelta, Color.White, align);

            MyGuiManager.DrawString(font, text, textPos, m_textScale);

            if (drawOxygen)
            {
                var oxygenFont = MyFontEnum.Blue;
                var oxygenText = new StringBuilder("Oxygen: ");
                if (oxygenLevel == 0f)
                {
                    oxygenText.Append("None");
                    oxygenFont = MyFontEnum.Red;
                }
                else if (oxygenLevel < 0.5f)
                {
                    oxygenText.Append("Low");
                    oxygenFont = MyFontEnum.Red;
                }
                else
                {
                    oxygenText.Append("High");
                }

                MyGuiManager.DrawString(oxygenFont, oxygenText, textPos - new Vector2(0f, 0.025f), m_textScale);
            }

            if (anyGravity)
            {
                MyGuiManager.DrawString(MyFontEnum.White, m_hudIndicatorText, gTextPos, m_textScale);
            }

            position = MyGuiManager.GetHudSize() * ConvertNormalizedGuiToHud(ref position);
            if (MyVideoSettingsManager.IsTripleHead())
            {
                position.X += 1.0f;
            }

            // Draw each of gravity indicators.
            foreach (var generatorGravity in MyGravityProviderSystem.GravityVectors)
            {
                DrawGravityVectorIndicator(position, generatorGravity, MyHudTexturesEnum.gravity_arrow, Color.Gray);
            }

            //if (MyPhysics.HavokWorld.Gravity != Vector3.Zero)
            //    DrawGravityVectorIndicator(position, MyPhysics.HavokWorld.Gravity, MyHudTexturesEnum.gravity_arrow, Color.Gray);

            if (anyGravity)
            {
                DrawGravityVectorIndicator(position, gravity, MyHudTexturesEnum.gravity_arrow, Color.White);
            }

            // Draw center
            MyAtlasTextureCoordinate centerTextCoord;

            if (anyGravity)
            {
                centerTextCoord = GetTextureCoord(MyHudTexturesEnum.gravity_point_white);
            }
            else
            {
                centerTextCoord = GetTextureCoord(MyHudTexturesEnum.gravity_point_red);
            }

            float   hudSizeX    = MyGuiManager.GetSafeFullscreenRectangle().Width / MyGuiManager.GetHudSize().X;
            float   hudSizeY    = MyGuiManager.GetSafeFullscreenRectangle().Height / MyGuiManager.GetHudSize().Y;
            Vector2 rightVector = Vector2.UnitX;

            MyRenderProxy.DrawSpriteAtlas(
                m_atlas,
                position,
                centerTextCoord.Offset,
                centerTextCoord.Size,
                rightVector,
                new Vector2(hudSizeX, hudSizeY),
                MyHudConstants.HUD_COLOR_LIGHT,
                Vector2.One * 0.005f);
        }