public override void Draw()
        {
            base.Draw();
            MyGuiManager.EndSpriteBatch();
            Vector2 normalizeSize = new Vector2(483 / 1600f, 112 / 1200f);//MyGuiManager.GetNormalizedCoordsAndPreserveOriginalSize(483, 112); 559?
            Vector2 stencilPos = GetParent().GetPositionAbsolute() - m_size.Value / 2f;
            Vector2 senctilSize = new Vector2(normalizeSize.X * m_value, normalizeSize.Y) + new Vector2(38 / 1600f, 0);//MyGuiManager.GetNormalizedCoordsAndPreserveOriginalSize(38, 0);            
            Utils.MyRectangle2D stencilRect = new Utils.MyRectangle2D(stencilPos, senctilSize);            
            MyGuiManager.DrawStencilMaskRectangle(stencilRect, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP);
            MyGuiManager.BeginSpriteBatch_StencilMask();
            // draw progress bar            
            MyGuiManager.DrawSpriteBatch(MyGuiManager.GetProgressBarTexture(), GetParent().GetPositionAbsolute(), m_size.Value, new Color(m_progressColor), MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER);
            MyGuiManager.EndSpriteBatch_StencilMask();
            MyGuiManager.BeginSpriteBatch();

            // draw progress value
            m_progressValueText.Clear();
            float percentage = m_value * 100f;
            if (m_decimals > 0)
            {
                m_progressValueText.AppendDecimal(percentage, m_decimals);
            }
            else 
            {
                m_progressValueText.AppendInt32((int)percentage);
            }
            m_progressValueText.Append(PERCENTAGE);
            MyGuiManager.DrawString(MyGuiManager.GetFontMinerWarsWhite(), m_progressValueText, GetParent().GetPositionAbsolute() - new Vector2(0f, m_size.Value.Y / 2f), m_textScale, new Color(m_textColor), MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER);
        }
예제 #2
0
        public override void Draw()
        {
            base.Draw();
            MyGuiManager.EndSpriteBatch();
            Vector2 normalizeSize = new Vector2(483 / 1600f, 112 / 1200f);                                                //MyGuiManager.GetNormalizedCoordsAndPreserveOriginalSize(483, 112); 559?
            Vector2 stencilPos    = GetParent().GetPositionAbsolute() - m_size.Value / 2f;
            Vector2 senctilSize   = new Vector2(normalizeSize.X * m_value, normalizeSize.Y) + new Vector2(38 / 1600f, 0); //MyGuiManager.GetNormalizedCoordsAndPreserveOriginalSize(38, 0);

            Utils.MyRectangle2D stencilRect = new Utils.MyRectangle2D(stencilPos, senctilSize);
            MyGuiManager.DrawStencilMaskRectangle(stencilRect, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP);
            MyGuiManager.BeginSpriteBatch_StencilMask();
            // draw progress bar
            MyGuiManager.DrawSpriteBatch(MyGuiManager.GetProgressBarTexture(), GetParent().GetPositionAbsolute(), m_size.Value, new Color(m_progressColor), MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER);
            MyGuiManager.EndSpriteBatch_StencilMask();
            MyGuiManager.BeginSpriteBatch();

            // draw progress value
            m_progressValueText.Clear();
            float percentage = m_value * 100f;

            if (m_decimals > 0)
            {
                m_progressValueText.AppendDecimal(percentage, m_decimals);
            }
            else
            {
                m_progressValueText.AppendInt32((int)percentage);
            }
            m_progressValueText.Append(PERCENTAGE);
            MyGuiManager.DrawString(MyGuiManager.GetFontMinerWarsWhite(), m_progressValueText, GetParent().GetPositionAbsolute() - new Vector2(0f, m_size.Value.Y / 2f), m_textScale, new Color(m_textColor), MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER);
        }