Quantcast
Channel: beginners - openFrameworks
Viewing all articles
Browse latest Browse all 4929

Creating a custom slider?

$
0
0

@Lewis wrote:

Does anybody know how I’d go about creating a custom slider with 2D Shapes without using any addons?

I had the idea of using the mouseDragged function and finding the coords of the circle for the slider value and moving it on click, but all it does is move to the right, I can’t move it back and I am unsure of how to stop it from moving outside of the shape it’s layered over.

void ofApp::mouseDragged(int x, int y, int button) {
	if ((x >= sliderX && x <= sliderX + 128) && (y >= sliderY && y <= sliderY + 128)) {
		sliderX = x;
	}
}

Thanks

Posts: 3

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 4929

Trending Articles