public override void Update() { base.Update(); incr.Position += Position + new Vector2(Hitbox.Width - decr.Hitbox.Width - 16f, 0f); incr.Update(); incr.Position -= Position + new Vector2(Hitbox.Width - decr.Hitbox.Width - 16f, 0f); decr.Position += Position + new Vector2(Hitbox.Width - 8f, 0f); decr.Update(); decr.Position -= Position + new Vector2(Hitbox.Width - 8f, 0f); }
public override void Update() { if (GInput.Keyboard.IsKeyDown(Key.Back)) { Destroy(); return; } // move window BeingDragged = false; if (GInput.Mouse.Rectangle.Intersects(new Rectangle((int)Position.X - (int)padding.X, (int)Position.Y - (int)padding.Y, (int)topBar.X, (int)topBar.Y)) && GInput.Mouse.Left) { if (!BeingDragged) { mouseRelativeTo = GInput.Mouse.Position - Position; if (OnDraggingStarted != null) { OnDraggingStarted(this); } if (GlobalDraggingStarted != null) { GlobalDraggingStarted(this); } } BeingDragged = true; } else if (BeingDragged) { mouseRelativeTo = Vector2.Zero; BeingDragged = false; if (OnDraggingStopped != null) { OnDraggingStopped(this); } if (GlobalDraggingStopped != null) { GlobalDraggingStopped(this); } } if (BeingDragged) { Position = GInput.Mouse.Position - mouseRelativeTo; if (OnDragging != null) { OnDragging(this); } if (GlobalDragging != null) { GlobalDragging(this); } } // update button close.Position += Position; close.Update(); close.Position -= Position; Position += topBar; base.Update(); Position -= topBar; }