Example #1
0
        public override void Draw(UISpriteBatch batch)
        {
            var frame      = Button.CurrentFrameIndex;
            var frameWidth = _FrameTexture.Width / 3.0f;

            if (_Texture != null)
            {
                var texture = _Texture.Get(batch.GraphicsDevice);

                var thumbScale = new Vector2(_ThumbSize.X / texture.Width, _ThumbSize.Y / texture.Height);
                DrawLocalTexture(batch, texture, new Rectangle(0, 0, texture.Width, texture.Height), _Offset, thumbScale);
            }

            DrawLocalTexture(batch, _FrameTexture, new Rectangle((int)(frame * frameWidth), 0, (int)frameWidth, _FrameTexture.Height), Vector2.Zero);
        }
Example #2
0
        public override void Draw(UISpriteBatch batch)
        {
            base.Draw(batch);

            if (_Icon != null)
            {
                var texture = _Icon.Get(batch.GraphicsDevice);

                if (_Size == UIPersonButtonSize.SMALL)
                {
                    var scale = new Vector2(16.0f / texture.Width, 16.0f / texture.Height);
                    DrawLocalTexture(batch, texture, null, new Vector2(2, 2), scale);
                }
                else if (_Size == UIPersonButtonSize.LARGE)
                {
                    var scale = new Vector2(30.0f / texture.Width, 30.0f / texture.Height);
                    DrawLocalTexture(batch, texture, null, new Vector2(2, 2), scale);
                }
            }
        }