Beispiel #1
0
        public override void Draw(SpriteBatch sb, DrawComponents drawComponents)
        {
            if (!Visible)
            {
                return;
            }
            if (IsDirty)
            {
                Recalculate();
            }
            //sb.Draw(_cachedPanel, CleanRect, Color.White);
            for (int i = 0; i < _controls.Count; i++)
            {
                _controls[i].Draw(sb, drawComponents);
            }

            sb.Draw(_spriteSheet, _middleTop, Ui.Border.WindowMiddleTop, Color.White);
            sb.Draw(_spriteSheet, _middleLeft, Ui.Border.WindowMiddleLeft, Color.White);
            sb.Draw(_spriteSheet, _middleRight, Ui.Border.WindowMiddleRight, Color.White);
            sb.Draw(_spriteSheet, _middleBottom, Ui.Border.WindowMiddleBottom, Color.White);

            sb.Draw(_spriteSheet, _topLeft, Ui.Border.WindowTopLeft, Color.White);
            sb.Draw(_spriteSheet, _topRight, Ui.Border.WindowTopRight, Color.White);
            sb.Draw(_spriteSheet, _bottomLeft, Ui.Border.WindowBottomLeft, Color.White);
            sb.Draw(_spriteSheet, _bottomRight, Ui.Border.WindowBottomRight, Color.White);
        }
        public override void Draw(SpriteBatch sb, DrawComponents drawComponents)
        {
            if (!Visible)
            {
                return;
            }
            if (IsDirty)
            {
                Recalculate();
            }
            // draw background
            sb.Draw(Pixel.ListBackground, CleanRect, Color.White);
            // draw border
            sb.Draw(_spriteSheet, _destRectTop, Ui.Border.Top, Color.White);
            sb.Draw(_spriteSheet, _destRectLeft, Ui.Border.Left, Color.White);
            sb.Draw(_spriteSheet, _destRectRight, Ui.Border.Right, Color.White);
            sb.Draw(_spriteSheet, _destRectBottom, Ui.Border.Bottom, Color.White);

            // draw items
            for (int i = VerticalScrollIndex;
                 i < _items.Count && i - VerticalScrollIndex < VerticalMaxVisibleItems;
                 i++)
            {
                _items[i].Draw(sb, drawComponents, _selectedItem?.Value.Equals(_items[i].Value) ?? false);
            }

            if (VerticalItemCount > VerticalMaxVisibleItems)
            {
                _scrollBar.Draw(sb, drawComponents);
            }
        }
        public override void Draw(SpriteBatch sb, DrawComponents drawComponents)
        {
            if (!Visible)
            {
                return;
            }
            if (IsDirty)
            {
                Recalculate();
            }
            for (var i = 0; i < _backgroundRects.Length; i++)
            {
                sb.Draw(_spriteSheet, _backgroundRects[i], Ui.Background, Color.White);
            }

            for (var i = 0; i < _captionBackgroundRects.Length; i++)
            {
                sb.Draw(_spriteSheet, _captionBackgroundRects[i], Ui.CaptionBackground, Color.White);
            }

            sb.Draw(_spriteSheet, _middleTop, Ui.Border.WindowMiddleTop, Color.White);
            sb.Draw(_spriteSheet, _middleLeft, Ui.Border.WindowMiddleLeft, Color.White);
            sb.Draw(_spriteSheet, _middleRight, Ui.Border.WindowMiddleRight, Color.White);
            sb.Draw(_spriteSheet, _middleBottom, Ui.Border.WindowMiddleBottom, Color.White);


            drawComponents.FontRenderer.DrawCachedString(sb, _caption, _captionPos);
            drawComponents.FontRenderer.DrawCachedString(sb, _text, _textPos);
            _button.Draw(sb, drawComponents);

            sb.Draw(_spriteSheet, _topLeft, Ui.Border.WindowTopLeft, Color.White);
            sb.Draw(_spriteSheet, _topRight, Ui.Border.WindowTopRight, Color.White);
            sb.Draw(_spriteSheet, _bottomLeft, Ui.Border.WindowBottomLeft, Color.White);
            sb.Draw(_spriteSheet, _bottomRight, Ui.Border.WindowBottomRight, Color.White);
        }
        public override void Draw(SpriteBatch sb, DrawComponents drawComponents)
        {
            sb.Draw(_spriteSheet, CleanRect, _spritePosition, Color);
            var overlay = _state switch
            {
                ButtonStates.Normal => _spriteNormalOverlay,
                ButtonStates.Pressed => _spritePressedOverlay,
            };

            sb.Draw(_spriteSheet, CleanRect, overlay, Color);
        }
 public void Draw(SpriteBatch sb, DrawComponents drawComponents, bool selected)
 {
     if (selected)
     {
         sb.Draw(Pixel.White, Bounds, Color.LightGray);
     }
     else if (MouseManager.IsHovering(Bounds))
     {
         sb.Draw(Pixel.White, Bounds, Color.LightBlue);
     }
     Label.Color = selected ? Color.Red : Color.White;
     Label.Draw(sb, drawComponents);
 }
Beispiel #6
0
        public void PreRender(SpriteBatch sb, DrawComponents drawComponents)
        {
            // fix later
            return;

            if (!IsDirty)
            {
                return;
            }
            var clean = CleanRect;

            SetRect(_rectDrawing);
            Recalculate();

            _cachedPanel?.Dispose();
            _cachedPanel = new RenderTarget2D(sb.GraphicsDevice, Width, Height, false,
                                              SurfaceFormat.Color, DepthFormat.None, 0, RenderTargetUsage.PreserveContents);
            sb.GraphicsDevice.SetRenderTarget(_cachedPanel);
            sb.UsualBegin();
            _cleanRect = clean;
            sb.UsualEnd();
            IsDirty = false;
        }
Beispiel #7
0
            public void Draw(SpriteBatch sb, DrawComponents drawComponents, bool selected, bool imageList)
            {
                if (imageList)
                {
                    if (selected)
                    {
                        sb.Draw(Pixel.White, Bounds, Color.LightGray);
                    }
                    else if (MouseManager.IsHovering(Bounds))
                    {
                        sb.Draw(Pixel.White, Bounds, Color.LightBlue);
                    }
                    Label.Color = selected ? Color.Red : Color.White;
                    ImageBox.Draw(sb, drawComponents);
                    Label.Draw(sb, drawComponents);
                }
                else
                {
                    if (selected)
                    {
                        sb.Draw(Pixel.White, Bounds, Color.LightGray);
                    }
                    else if (MouseManager.IsHovering(Bounds))
                    {
                        sb.Draw(Pixel.White, Bounds, Color.LightBlue);
                    }

                    var color =
                        selected
                            ? Color.Red
                            : MouseManager.IsHovering(Bounds)
                                ? Color.LightBlue
                                : Color.White;
                    ImageBox.Color = color;
                    ImageBox.Draw(sb, drawComponents);
                }
            }