示例#1
0
        internal override void Draw(GameTime gameTime)
        {
            ShapeRenderer.DrawRectangle(_backgroundColor, ClientAreaRectangle);
            ShapeRenderer.DrawBorder(Focused ? _borderColorFocused : _borderColorUnfocused, ClientAreaRectangle, BORDER_WIDTH);

            SpriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, null, null, _scissorState);

            Rectangle preScissor = GraphicsDevice.ScissorRectangle;

            GraphicsDevice.ScissorRectangle = _scissorRectangle;

            SpriteBatch.DrawString(ContentLibrary.UIFont_Small, _text, AbsoluteClientAreaPosition + new Vector2(2 - _currentOffset, (Height - ContentLibrary.UIFont_Small.LineSpacing) / 2f), TextColor);

            if (Focused)
            {
                if (Environment.TickCount - _lastSwitchCaretVisibility >= 500 || _forceCaretVisible)
                {
                    _lastSwitchCaretVisibility = Environment.TickCount;
                    _showCaret = !_showCaret || _forceCaretVisible;
                }

                if (_showCaret)
                {
                    SpriteBatch.Draw(ContentLibrary.DummyTexture, new Rectangle((int)_caretPosition.X, (int)_caretPosition.Y, 1, ContentLibrary.UIFont_Small.LineSpacing), _textColor);
                }
            }

            GraphicsDevice.ScissorRectangle = preScissor;

            SpriteBatch.End();
        }
示例#2
0
        internal override void Draw(GameTime gameTime)
        {
            if (_renderBackgroundTexture != null)
            {
                ShapeRenderer.DrawRectangle(_renderBackgroundTexture, ClientAreaRectangle, _renderBackgroundColor);
            }

            for (int i = 0; i < ChildControls.Count; i++)
            {
                ChildControls[i].Draw(gameTime);
            }

            ShapeRenderer.DrawBorder(Focused ? _borderColorFocused : _borderColorUnfocused, ClientAreaRectangle, BORDER_WIDTH);
        }
        internal override void Draw(GameTime gameTime)
        {
            if (_renderBackgroundTexture != null)
            {
                ShapeRenderer.DrawRectangle(_renderBackgroundTexture, ClientAreaRectangle, _renderBackgroundColor);
            }

            for (int i = 0; i < _tabPages.Count; i++)
            {
                _tabPages[i].Button.Draw(gameTime);
            }

            if (CurrentPanel != null)
            {
                CurrentPanel.Draw(gameTime);
            }

            ShapeRenderer.DrawBorder(Focused ? _borderColorFocused : _borderColorUnfocused, ClientAreaRectangle, BORDER_WIDTH);
        }
示例#4
0
        internal override void Draw(GameTime gameTime)
        {
            if (_renderBackgroundTexture != null)
            {
                ShapeRenderer.DrawRectangle(_renderBackgroundTexture, ControlRectangle, _renderBackgroundColor);
            }

            if (Focused)
            {
                ShapeRenderer.DrawBorder(_borderColorFocused, ClientAreaRectangle, BORDER_WIDTH);
            }

            Vector2 dim = _renderSpriteFont.MeasureString(_text);

            SpriteBatch.Begin();

            Point center = ClientAreaRectangle.Center;

            SpriteBatch.DrawString(_renderSpriteFont, _text, new Vector2(center.X - dim.X / 2f, center.Y - dim.Y / 2f), _renderTextColor);

            SpriteBatch.End();
        }