Example #1
0
        public override void Draw(SpriteBatch sb)
        {
            Vector2 position = this.position;

            if (parent != null)
            {
                position += this.parent.position;
            }
            this.rectangle = new Rectangle((int)position.X, (int)position.Y, (int)this.size.X, (int)this.size.Y);
            Color color = Color.White;

            if (new Rectangle(Main.mouseX, Main.mouseY, 1, 1).Intersects(this.rectangle))
            {
                this.hover = true;
                color      = Color.LightGray;
                if (UIParameters.mouseState.LeftButton == ButtonState.Pressed && UIParameters.mouseRect.Intersects(new Rectangle((int)position.X, (int)position.Y, (int)this.size.X, (int)this.size.Y)))
                {
                    color = new Color(167, 167, 167, 255);
                }
                if (UIParameters.LeftMouseClick(new Rectangle((int)position.X, (int)position.Y, (int)this.size.X, (int)this.size.Y)))
                {
                    this.Function();
                }
            }
            if (this.texture == null)
            {
                BaseTextureDrawing.DrawRectangleBox(sb, color, Color.Black, this.rectangle, 1);
            }
            else
            {
                sb.Draw(this.texture, this.rectangle, color);
            }
            base.Draw(sb);
        }
Example #2
0
        public override void Draw(SpriteBatch sb)
        {
            Vector2 position = this.position;

            if (parent != null)
            {
                position += this.parent.position;
            }
            this.rectangle = new Rectangle((int)position.X, (int)position.Y, (int)this.size.X, (int)this.size.Y);
            if (this.t != null)
            {
                sb.Draw(this.t, this.rectangle, Color.White);
            }
            else
            {
                BaseTextureDrawing.DrawTerrariaStyledBox(sb, new Color(10, 10, 140), this.rectangle);
            }
            base.Draw(sb);
        }