示例#1
0
        internal override void Update(UIMouseState mouseState)
        {
            if (this.ContainsPoint(mouseState.MouseX, mouseState.MouseY))
            {
                this.Hovered = true;

                if (mouseState.MouseLeftDown && !this.Active)
                {
                    this.Active = true;
                    Invalidate();
                }
                else if (!mouseState.MouseLeftDown && this.Active)
                {
                    this.Active = false;
                    OnClicked?.Invoke(this, EventArgs.Empty);
                    Invalidate();
                }
            }
            else
            {
                if (this.Hovered)
                {
                    if (this.Active)
                    {
                        this.Active = false;
                        Invalidate();
                    }

                    this.Hovered = false;
                }
            }
        }
示例#2
0
        internal PicoGui(PicoGfx gfx, int width, int height)
        {
            _guiSurface = new PicoSurface(gfx, width, height, PicoSurface.AccessType.Target);

            _uiMouseState = new UIMouseState();

            _theme = new DefaultTheme();

            _root = new Container(this, width, height);

            PicoGui.Instance = this;
        }
示例#3
0
        internal override void Update(UIMouseState mouseState)
        {
            if (_layoutInvalidated)
            {
                DoLayout();
                _layoutInvalidated = false;
            }

            foreach (var widget in _children)
            {
                if (this.BoundingRect.Intersects(widget.BoundingRect))
                {
                    widget.Update(mouseState);
                }
            }
        }
示例#4
0
        internal override void Update(UIMouseState mouseState)
        {
            if (this.ContainsPoint(mouseState.MouseX, mouseState.MouseY))
            {
                if (mouseState.MouseLeftDown)
                {
                    if (!_sliding)
                    {
                        _sliding = true;
                        UpdateIndicator(mouseState.MouseX, mouseState.MouseY);
                    }
                }
            }

            if (!mouseState.MouseLeftDown && _sliding)
            {
                _sliding = false;
            }

            if (_sliding && mouseState.Moved)
            {
                UpdateIndicator(mouseState.MouseX, mouseState.MouseY);
            }
        }
示例#5
0
 internal abstract void Update(UIMouseState mouseState);