I’m trying to code a slider from scratch and I’ve got a basic functionality, but I’d like to be able to drag the sliders beyond the bounds I created for clicking on it.
void slide()
{
if ((x+w >= mouseX) && (mouseX >= x) && (y+h >= mouseY) && (mouseY >= y) &&
(mousePressed == true))
{
h = (mouseY - y);
}
As you can see when the mouse is dragged outside of the slider dimensions, the height value no longer changes. How can I activate only within the dimensions then drag outside of them?
I have done this trough a boolean to control the click and lock, like: