public override void Update(GameTime gameTime, Input input) { front.Update(gameTime, input); if (dragging) { front.position.X = MathHelper.Clamp(input.MousePosition.X - relativeX, position.X, position.X + Size.X - front.size.X); //Pas posotie van de slider aan label.Label = Text + ": " + Math.Round(Value, 1).ToString(); } if (input.IsLeftMouseUp()) //Het loslaten van de muis hoeft niet persé boven de SliderFront te gebeuren dragging = false; }
public override void Update(GameTime gameTime, Input input) { mousePosition = input.MousePosition; if (mousePosition.Y > position.Y && mousePosition.Y < position.Y + size.Y) { if (input.IsLeftMouseDown() && ButtonDown != null) ButtonDown(this, new EventArgs()); else if (input.IsLeftMouseUp() && ButtonUp != null) ButtonUp(this, new EventArgs()); } scale = 1.0f; if (mousePosition.X > position.X && mousePosition.X < position.X + size.X && mousePosition.Y > position.Y && mousePosition.Y < position.Y + size.Y) scale = 1.2f; }