override public void DrawEntity(SpriteBatch spriteBatch, bool?BaseDraw = null)
        {
            if (UiManager.GetActiveUserInterface().ActiveEntity != this)
            {
                CalcAutoMaxValue();
            }

            Texture2D texture     = ContentLoader.GetTextureByName("tan_pressed");
            Texture2D markTexture = ContentLoader.GetTextureByName("tan_pressed");

            float FrameHeight = 0.14f;

            UiManager.GetActiveUserInterface().drawUtils.Draw(spriteBatch, texture, p_DrawArea, texture.Bounds, Color.White);

            Vector2 frameSizeTexture = new Vector2(texture.Width, texture.Height * FrameHeight);
            Vector2 frameSizeRender  = frameSizeTexture;
            float   ScaleYfac        = p_DrawArea.Width / frameSizeRender.X;

            int markWidth = p_DrawArea.Width;

            _markHeight = (int)(((float)markTexture.Height / (float)markTexture.Width) * (float)markWidth);

            _frameActualHeight = FrameHeight * texture.Height * ScaleYfac;

            float     markY    = p_DrawArea.Y + _frameActualHeight + _markHeight * 0.5f + (p_DrawArea.Height - _frameActualHeight * 2 - _markHeight) * (GetValueAsPercent());
            Rectangle markDest = new Rectangle(p_DrawArea.X, (int)Math.Round(markY) - _markHeight / 2, markWidth, _markHeight);

            UiManager.GetActiveUserInterface().drawUtils.Draw(spriteBatch, markTexture, markDest, markTexture.Bounds, Color.DarkGray);

            base.DrawEntity(spriteBatch, true);
        }
Esempio n. 2
0
        override public void DrawEntity(SpriteBatch spriteBatch, bool?BaseDraw = null)
        {
            if (BaseDraw == null)
            {
                Texture2D texture     = ContentLoader.GetTextureByName("tan_pressed");
                Texture2D markTexture = ContentLoader.GetTextureByName("tan_pressed");

                float frameWidth = 0.03f;

                UiManager.GetActiveUserInterface().drawUtils.Draw(spriteBatch, texture, p_DrawArea, texture.Bounds, Color.White);

                Vector2 frameSizeTexture = new Vector2(texture.Width * frameWidth, texture.Height);
                Vector2 frameSizeRender  = frameSizeTexture;
                float   ScaleXfac        = p_DrawArea.Height / frameSizeRender.Y;

                int markHeight = p_DrawArea.Height;
                p_MarkWidth = (int)(((float)markTexture.Width / (float)markTexture.Height) * (float)markHeight);

                p_FrameActualWidth = frameWidth * texture.Width * ScaleXfac;

                float     markX    = p_DrawArea.X + p_FrameActualWidth + p_MarkWidth * 0.5f + (p_DrawArea.Width - p_FrameActualWidth * 2 - p_MarkWidth) * GetValueAsPercent();
                Rectangle markDest = new Rectangle((int)System.Math.Round(markX) - p_MarkWidth / 2, p_DrawArea.Y, p_MarkWidth, markHeight);

                UiManager.GetActiveUserInterface().drawUtils.Draw(spriteBatch, markTexture, markDest, markTexture.Bounds, Color.White);

                base.DrawEntity(spriteBatch);
            }
            else
            {
                base.DrawEntity(spriteBatch);
            }
        }
Esempio n. 3
0
        public override void DrawEntity(SpriteBatch spriteBatch, bool?BaseDraw = null)
        {
            if (BaseDraw == null)
            {
                if (HighlightColor.A > 0 || State == EntityState.MouseHover)
                {
                    Color backColor = UiManager.GetActiveUserInterface().drawUtils.FixColorOpacity(HighlightColor);
                    var   rect      = HighlightColorUseBoxSize ? p_DrawArea : p_ActualDrawRect;

                    if (HighlightColorUseBoxSize)
                    {
                        rect.Height = (int)(rect.Height / GlobalScale / LocalScale);
                    }

                    var Padding = new Point((int)(HighlightColorPadding.X * GlobalScale * LocalScale), (int)(HighlightColorPadding.Y * GlobalScale * LocalScale));
                    rect.Location -= Padding;
                    rect.Size     += Padding + Padding;

                    Texture2D New = ContentLoader.GetTextureByName("WhiteTexture");

                    spriteBatch.Draw(New, rect, HighlightColor);
                }

                Color fillColor = OverlayColor;

                Vector2 fontOrigin = new Vector2((int)p_FontOrigin.X, (int)p_FontOrigin.Y);

                spriteBatch.DrawString(p_CurrentFont, p_ProcessedText, p_Position, fillColor, 0, fontOrigin, p_ActualScale, SpriteEffects.None, 0.5f);

                base.DrawEntity(spriteBatch);
            }
            else if (BaseDraw == true)
            {
                base.DrawEntity(spriteBatch);
            }
        }
Esempio n. 4
0
 public Panel(PanelProps panelProps) : base(panelProps)
 {
     p_BackGroundTexture = panelProps.Backgroundtexture != null ? panelProps.Backgroundtexture : new Sprite(ContentLoader.GetTextureByName("tan_pressed"));
 }