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; } } }
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; }
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); } } }
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); } }
internal abstract void Update(UIMouseState mouseState);