コード例 #1
0
        /// <summary>
        /// Add textured quad with specified UP direction and width/height.
        /// </summary>
        protected void AddTexturedQuad(MyHudTexturesEnum texture, Vector2 position, Vector2 upVector, Color color, float halfWidth, float halfHeight)
        {
            Vector2 rightVector = new Vector2(-upVector.Y, upVector.X);

            MyAtlasTextureCoordinate textureCoord = m_hudScreen.GetTextureCoord(texture);

            float hudSizeX = MyGuiManager.GetSafeFullscreenRectangle().Width / MyGuiManager.GetHudSize().X;
            float hudSizeY = MyGuiManager.GetSafeFullscreenRectangle().Height / MyGuiManager.GetHudSize().Y;
            var   pos      = position;

            if (MyVideoSettingsManager.IsTripleHead())
            {
                pos.X += 1.0f;
            }

            VRageRender.MyRenderProxy.DrawSpriteAtlas(
                m_hudScreen.TextureAtlas,
                pos,
                textureCoord.Offset,
                textureCoord.Size,
                rightVector,
                new Vector2(hudSizeX, hudSizeY),
                color,
                new Vector2(halfWidth, halfHeight));
        }
コード例 #2
0
        public void DrawTexts()
        {
            if (m_texts.GetAllocatedCount() <= 0)
            {
                return;
            }

            for (int i = 0; i < m_texts.GetAllocatedCount(); i++)
            {
                MyHudText text = m_texts.GetAllocatedItem(i);
                if (text.GetStringBuilder().Length == 0)
                {
                    continue;
                }

                var font = text.Font;
                text.Position /= MyGuiManager.GetHudSize();
                var normalizedCoord = ConvertHudToNormalizedGuiPosition(ref text.Position);

                Vector2 textSize = MyGuiManager.MeasureString(font, text.GetStringBuilder(), MyGuiSandbox.GetDefaultTextScaleWithLanguage());
                textSize *= text.Scale;
                MyGuiTextShadows.DrawShadow(ref normalizedCoord, ref textSize, null, text.Color.A / 255f, text.Alignement);
                MyGuiManager.DrawString(font, text.GetStringBuilder(), normalizedCoord, text.Scale, colorMask: text.Color, drawAlign: text.Alignement);
            }

            m_texts.ClearAllAllocated();
        }
コード例 #3
0
ファイル: AeroDrawIndicators.cs プロジェクト: zrisher/ARMS
        /// <summary>
        /// Modified from MyGuiScreenHudSpace.DrawGravityIndicator.
        /// </summary>
        private static void DrawAirAndDrag_CalcultatePositions()
        {
            MyGuiPaddedTexture backgroundTexture = MyGuiConstants.TEXTURE_HUD_BG_MEDIUM_DEFAULT;

            backgroundSize    = backgroundTexture.SizeGui + new Vector2(0.017f, 0.05f);
            backgroundSize.X *= 0.8f;
            backgroundSize.Y *= 0.85f;

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

            backgroundPosition = new Vector2(0.01f, backgroundSize.Y + 0.04f);
            backgroundPosition = MyGuiScreenHudBase.ConvertHudToNormalizedGuiPosition(ref backgroundPosition);

            titleTextPos        = backgroundPosition + backgroundSize * new Vector2(0.90f, -1f) + backgroundTexture.PaddingSizeGui * Vector2.UnitY * 0.2f;
            dividerLinePosition = new Vector2(backgroundPosition.X + backgroundTexture.PaddingSizeGui.X * 0.5f, titleTextPos.Y - 0.022f) + new Vector2(0.0f, 0.026f);

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

            vectorPosition = MyGuiManager.GetHudSize() * (Vector2)MyGuiScreenHudBase_ConvertNormalizedGuiToHud.Invoke(null, new object[] { vectorPosition });

            airDensityTextPos = backgroundPosition + backgroundSize * new Vector2(0.75f, -0.1f) + backgroundTexture.PaddingSizeGui * Vector2.UnitY * 0.2f;

            backgroundSize += new Vector2(0f, 0.025f);

            DrawGravityVectorIndicator_Params[0] = vectorPosition;
        }
コード例 #4
0
        public void DrawTexts()
        {
            if (m_texts.GetAllocatedCount() <= 0)
            {
                return;
            }

            for (int i = 0; i < m_texts.GetAllocatedCount(); i++)
            {
                MyHudText text = m_texts.GetAllocatedItem(i);

                var font = text.Font;
                text.Position /= MyGuiManager.GetHudSize();
                var normalizedCoord = ConvertHudToNormalizedGuiPosition(ref text.Position);

                Vector2 textSize = MyGuiManager.MeasureString(font, text.GetStringBuilder(), MyGuiSandbox.GetDefaultTextScaleWithLanguage());
                textSize.X *= 0.9f;
                textSize.Y *= 0.7f;
                MyGuiScreenHudBase.DrawFog(ref normalizedCoord, ref textSize);

                MyGuiManager.DrawString(font, text.GetStringBuilder(), normalizedCoord, text.Scale, colorMask: text.Color, drawAlign: MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER);
            }

            m_texts.ClearAllAllocated();
        }
コード例 #5
0
        public override void RecreateControls(bool constructor)
        {
            //This is probably very wrong!
            m_screenScale = (MyGuiManager.GetHudSize().X / MyGuiManager.GetHudSize().Y) / MyGuiConstants.SAFE_ASPECT_RATIO;

            m_size = new Vector2(m_screenScale, 0.5f);

            base.RecreateControls(constructor);
            Vector4 consoleTextColor = new Vector4(1, 1, 0, 1);
            float   consoleTextScale = 1f;

            m_commandLine = new MyGuiControlTextbox
                            (
                position: new Vector2(0, 0.25f),
                textColor: consoleTextColor
                            );

            m_commandLine.Position    -= new Vector2(0, m_commandLine.Size.Y + m_margin.Y / 2);
            m_commandLine.Size         = new Vector2(m_screenScale, m_commandLine.Size.Y) - 2 * m_margin;
            m_commandLine.ColorMask    = new Vector4(0, 0, 0, 0.5f);
            m_commandLine.VisualStyle  = MyGuiControlTextboxStyleEnum.Debug;
            m_commandLine.TextChanged += commandLine_TextChanged;
            m_commandLine.Name         = "CommandLine";


            m_autoComplete              = new MyGuiControlContextMenu();
            m_autoComplete.ItemClicked += autoComplete_ItemClicked;
            m_autoComplete.Deactivate();
            m_autoComplete.OriginAlign             = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP;
            m_autoComplete.ColorMask               = new Vector4(0, 0, 0, .5f);
            m_autoComplete.AllowKeyboardNavigation = true;
            m_autoComplete.Name = "AutoComplete";

            m_displayScreen = new MyGuiControlMultilineText
                              (
                position: new Vector2(-0.5f * m_screenScale, -0.25f) + m_margin,
                size: new Vector2(m_screenScale, 0.5f - m_commandLine.Size.Y) - 2 * m_margin,
                font: Common.MyFontEnum.Debug,
                textAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP,
                textBoxAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP,
                selectable: true
                              );

            m_displayScreen.TextColor   = Color.Yellow;
            m_displayScreen.TextScale   = consoleTextScale;
            m_displayScreen.OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP;
            m_displayScreen.Text        = MyConsole.DisplayScreen;
            m_displayScreen.ColorMask   = new Vector4(0, 0, 0, .5f);
            m_displayScreen.Name        = "DisplayScreen";

            Controls.Add(m_displayScreen);
            Controls.Add(m_commandLine);
            Controls.Add(m_autoComplete);
        }
コード例 #6
0
        public HaEConsoleScreen() : base(null, null, null, false, null, 0f, 0f)
        {
            this._screenScale = MyGuiManager.GetHudSize().X / MyGuiManager.GetHudSize().Y / HaEConstants.screenScaleConstant;

            this.m_backgroundTexture = MyGuiConstants.TEXTURE_MESSAGEBOX_BACKGROUND_INFO.Texture;
            this.m_backgroundColor   = new Vector4(0, 0, 0, 0.5f);     // Grey, half opacity
            this.m_size     = new Vector2(_screenScale, 0.5f);         // Half the screen, drop down from the top
            this.m_position = new Vector2(0.5f, 0.25f);                // HorizontalCenter / Quarter vertical

            _margin = new Vector2(0.06f, 0.04f);                       // Margin

            RecreateControls(true);
        }
コード例 #7
0
        public MyGuiScreenConsole()
        {
            m_backgroundTexture = MyGuiConstants.TEXTURE_MESSAGEBOX_BACKGROUND_INFO.Texture;
            m_backgroundColor   = new Vector4(0, 0, 0, .75f);
            m_position          = new Vector2(0.5f, 0.25f);
            m_screenScale       = (MyGuiManager.GetHudSize().X / MyGuiManager.GetHudSize().Y) / MyGuiConstants.SAFE_ASPECT_RATIO;
            m_size   = new Vector2(m_screenScale, 0.5f);
            m_margin = new Vector2(0.06f, 0.04f);

            m_keys = new MyConsoleKeyTimerController[3];
            m_keys[(int)MyConsoleKeys.UP]    = new MyConsoleKeyTimerController(MyKeys.Up);
            m_keys[(int)MyConsoleKeys.DOWN]  = new MyConsoleKeyTimerController(MyKeys.Down);
            m_keys[(int)MyConsoleKeys.ENTER] = new MyConsoleKeyTimerController(MyKeys.Enter);
        }
コード例 #8
0
        public static void DrawSelectionCorner(string atlasTexture, MyHudSelectedObject selection, MyAtlasTextureCoordinate textureCoord, Vector2 scale, Vector2 pos, Vector2 rightVector, float textureScale)
        {
            if (MyVideoSettingsManager.IsTripleHead())
            {
                pos.X = pos.X * 3;
            }

            VRageRender.MyRenderProxy.DrawSpriteAtlas(
                atlasTexture,
                pos,
                textureCoord.Offset,
                textureCoord.Size,
                rightVector,
                scale,
                selection.Color,
                selection.HalfSize / MyGuiManager.GetHudSize() * textureScale);
        }
コード例 #9
0
        public void Draw(string atlas, MyAtlasTextureCoordinate[] atlasCoords)
        {
            float hudSizeX = MyGuiManager.GetSafeFullscreenRectangle().Width / MyGuiManager.GetHudSize().X;
            float hudSizeY = MyGuiManager.GetSafeFullscreenRectangle().Height / MyGuiManager.GetHudSize().Y;
            var   pos      = m_position;

            if (MyVideoSettingsManager.IsTripleHead())
            {
                pos.X += 1.0f;
            }

            foreach (var sprite in m_sprites)
            {
                if (!sprite.Visible)
                {
                    continue;
                }

                int spriteCoord = (int)sprite.SpriteEnum;
                if (spriteCoord >= atlasCoords.Length)
                {
                    Debug.Assert(false, "Out of bounds of the crosshair array!");
                    continue;
                }

                MyAtlasTextureCoordinate textureCoord = atlasCoords[spriteCoord];

                Color spriteColor = sprite.Color;
                if (sprite.TimeRemaining < sprite.FadeoutTime)
                {
                    spriteColor.A = (byte)(spriteColor.A * sprite.TimeRemaining / sprite.FadeoutTime);
                }

                VRageRender.MyRenderProxy.DrawSpriteAtlas(
                    atlas,
                    pos,
                    textureCoord.Offset,
                    textureCoord.Size,
                    m_rightVector,
                    new Vector2(hudSizeX, hudSizeY),
                    spriteColor,
                    sprite.HalfSize);
            }
        }
コード例 #10
0
        public static void DrawCrosshair(string atlas, MyAtlasTextureCoordinate textureCoord, MyHudCrosshair crosshair)
        {
            Vector2 rightVector = new Vector2(crosshair.UpVector.Y, crosshair.UpVector.X);

            float hudSizeX = MyGuiManager.GetSafeFullscreenRectangle().Width / MyGuiManager.GetHudSize().X;
            float hudSizeY = MyGuiManager.GetSafeFullscreenRectangle().Height / MyGuiManager.GetHudSize().Y;
            var   pos      = crosshair.Position;

            if (MyVideoSettingsManager.IsTripleHead())
            {
                pos.X += 1.0f;
            }

            VRageRender.MyRenderProxy.DrawSpriteAtlas(
                atlas,
                pos,
                textureCoord.Offset,
                textureCoord.Size,
                rightVector,
                new Vector2(hudSizeX, hudSizeY),
                crosshair.Color,
                crosshair.HalfSize);
        }
コード例 #11
0
        private void DrawGravityVectorIndicator(Vector2 centerPos, Vector3 worldGravity, MyHudTexturesEnum texture, Color color)
        {
            float hudSizeX = MyGuiManager.GetSafeFullscreenRectangle().Width / MyGuiManager.GetHudSize().X;
            float hudSizeY = MyGuiManager.GetSafeFullscreenRectangle().Height / MyGuiManager.GetHudSize().Y;

            var textureCoord   = GetTextureCoord(texture);
            var viewGravity    = Vector3.TransformNormal(worldGravity, MySector.MainCamera.ViewMatrix);
            var viewGravityLen = viewGravity.Length();

            if (!MyUtils.IsZero(viewGravityLen))
            {
                viewGravity /= viewGravityLen;
            }

            var right    = new Vector2(viewGravity.Y, viewGravity.X);
            var rightLen = right.Length();

            if (!MyUtils.IsZero(rightLen))
            {
                right /= rightLen;
            }

            var scale = Vector2.One * new Vector2(0.003f, 0.013f);

            scale.Y *= rightLen;

            VRageRender.MyRenderProxy.DrawSpriteAtlas(
                m_atlas,
                centerPos + new Vector2(viewGravity.X, -viewGravity.Y) * 0.02f,
                textureCoord.Offset,
                textureCoord.Size,
                right,
                new Vector2(hudSizeX, hudSizeY),
                color,
                scale);
        }
コード例 #12
0
        /// <summary>
        /// Draws location marker on screen.
        /// </summary>
        public void DrawLocationMarker(int styleHandle, Vector3D position, MyHudEntityParams hudParams, float targetDamageRatio, float targetArmorRatio, float alphaMultiplifier = 1f)
        {
            if (MySession.ControlledEntity == null)
            {
                return;
            }

            //  Transform point to camera space, so Z = -1 is always forward and then do projective transformation
            Vector3D transformedPoint = Vector3D.Transform(position, MySector.MainCamera.ViewMatrix);
            Vector4D projectedPoint   = Vector4D.Transform(transformedPoint, MySector.MainCamera.ProjectionMatrix);

            //  If point is behind camera we swap X and Y (this is mirror-like transformation)
            if (transformedPoint.Z > 0)
            {
                projectedPoint.X *= -1;
                projectedPoint.Y *= -1;
            }

            if (projectedPoint.W == 0)
            {
                return;
            }

            MyMarkerStyle markerStyle = m_markerStyles[styleHandle];

            double distance         = Vector3D.Distance(position, MySession.ControlledEntity.Entity.WorldMatrix.Translation);
            float  maxDistance      = hudParams.MaxDistance;
            byte   colorAlphaInByte = 255;
            var    hudColor         = MyFakes.SHOW_FACTIONS_GUI ? markerStyle.Color : Color.White;

            hudColor.A = (byte)(colorAlphaInByte * alphaMultiplifier);

            //  Calculate centered coordinates in range <0..1>
            Vector2 projectedPoint2D = new Vector2((float)(projectedPoint.X / projectedPoint.W / 2.0f) + 0.5f, (float)(-projectedPoint.Y / projectedPoint.W) / 2.0f + 0.5f);

            if (MyVideoSettingsManager.IsTripleHead())
            {
                projectedPoint2D.X = (projectedPoint2D.X - (1.0f / 3.0f)) / (1.0f / 3.0f);
            }

            float objectNameYOffset = 0.0f; //offset to direction indicator

            //  This will bound the rectangle in circle, although it isn't real circle because we work in [1,1] dimensions,
            //  but number of horizontal pixels is bigger, so at the end it's more elypse
            //  It must be done when point is out of circle or behind the camera
            Vector2 direction = projectedPoint2D - MyHudConstants.DIRECTION_INDICATOR_SCREEN_CENTER;

            if ((direction.Length() > MyHudConstants.DIRECTION_INDICATOR_MAX_SCREEN_DISTANCE) || (transformedPoint.Z > 0))
            {
                if ((hudParams.FlagsEnum & MyHudIndicatorFlagsEnum.SHOW_BORDER_INDICATORS) == 0)
                {
                    return;
                }

                if (direction.LengthSquared() > MyMathConstants.EPSILON_SQUARED)
                {
                    direction.Normalize();
                }
                else
                {
                    direction = new Vector2(1f, 0f);
                }
                projectedPoint2D = MyHudConstants.DIRECTION_INDICATOR_SCREEN_CENTER + direction * MyHudConstants.DIRECTION_INDICATOR_MAX_SCREEN_DISTANCE;

                //  Fix vertical scale
                projectedPoint2D.Y *= MyGuiManager.GetHudSize().Y;

                AddTexturedQuad(markerStyle.TextureDirectionIndicator, projectedPoint2D + direction * MyHudConstants.HUD_DIRECTION_INDICATOR_SIZE * 2.5f, direction,
                                hudColor, MyHudConstants.HUD_DIRECTION_INDICATOR_SIZE * 1.2f, MyHudConstants.HUD_DIRECTION_INDICATOR_SIZE * 0.8f);
            }
            else
            {
                //  Fix vertical scale
                projectedPoint2D.Y *= MyGuiManager.GetHudSize().Y;

                Color rectangleColor = Color.White;
                rectangleColor.A = colorAlphaInByte;

                if ((hudParams.FlagsEnum & MyHudIndicatorFlagsEnum.SHOW_FOCUS_MARK) > 0)
                {
                    Vector2 upVector = new Vector2(0, -1);
                    if (markerStyle.TextureTargetRotationSpeed != 0)
                    {
                        upVector = new Vector2((float)Math.Cos(MySandboxGame.TotalGamePlayTimeInMilliseconds / 1000f * markerStyle.TextureTargetRotationSpeed * MathHelper.Pi),
                                               (float)Math.Sin(MySandboxGame.TotalGamePlayTimeInMilliseconds / 1000f * markerStyle.TextureTargetRotationSpeed * MathHelper.Pi));
                    }

                    AddTexturedQuad(markerStyle.TextureTarget, projectedPoint2D, upVector, hudColor, MyHudConstants.HUD_DIRECTION_INDICATOR_SIZE * markerStyle.TextureTargetScale, MyHudConstants.HUD_DIRECTION_INDICATOR_SIZE * markerStyle.TextureTargetScale);
                }

                objectNameYOffset = -MyHudConstants.HUD_TEXTS_OFFSET;
            }

            if (hudParams.Text != null && hudParams.Text.Length > 0 && (hudParams.FlagsEnum & MyHudIndicatorFlagsEnum.SHOW_TEXT) != 0)
            {
                //  Add object's name
                MyHudText objectName = m_hudScreen.AllocateText();
                if (objectName != null)
                {
                    objectName.Start(markerStyle.Font, projectedPoint2D + new Vector2(0, hudParams.OffsetText ? objectNameYOffset : 0),
                                     hudColor, 0.8f, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER);
                    objectName.Append(hudParams.Text);
                }
            }

            // display hud icon
            if (hudParams.Icon != null && (hudParams.FlagsEnum & MyHudIndicatorFlagsEnum.SHOW_ICON) != 0)
            {
                Color iconColor = hudParams.IconColor.HasValue && MyFakes.SHOW_FACTIONS_GUI ? hudParams.IconColor.Value : Color.White;
                iconColor.A = (byte)(colorAlphaInByte * alphaMultiplifier);

                AddTexturedQuad(hudParams.Icon.Value, projectedPoint2D + hudParams.IconOffset, new Vector2(0, -1), iconColor, hudParams.IconSize.X / 2f, hudParams.IconSize.Y / 2f);
            }

            if (MyFakes.SHOW_HUD_DISTANCES && (hudParams.FlagsEnum & MyHudIndicatorFlagsEnum.SHOW_DISTANCE) != 0)
            {
                //  Add distance to object
                MyHudText objectDistance = m_hudScreen.AllocateText();
                if (objectDistance != null)
                {
                    objectDistance.Start(markerStyle.Font, projectedPoint2D + new Vector2(0, MyHudConstants.HUD_TEXTS_OFFSET),
                                         hudColor, 0.8f, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER);

                    //  Create string builder with distance in metres, e.g. "123m"
                    objectDistance.AppendInt32((int)Math.Round(distance));
                    objectDistance.Append("m");
                }
            }
        }
コード例 #13
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);
        }