mouse position of multiple buttons
in
Programming Questions
•
2 years ago
hi,
i have like 314 images and i want to make buttons out of all of them. How can i do this simple?
i was thinking to have the mouse value of 262 and say that the value is between the 250-300, because the images are all 50X50. And are positioned in an grid. If i use an IF statement, i don't think it's the correct way to use this. Map() is not the correct way to do this either i think. What do you all think? I couldn't find a correct way to do this on the forum.
i was thinking:
18 is the amount of images next to each other.
for ( int x = 0; x <18; x++ ) {
if (mouseX <= x*50 && mouseX <= x*50){
println("range "+x*50);
x=18;
}
}
but i think it's wrong :)
i have like 314 images and i want to make buttons out of all of them. How can i do this simple?
i was thinking to have the mouse value of 262 and say that the value is between the 250-300, because the images are all 50X50. And are positioned in an grid. If i use an IF statement, i don't think it's the correct way to use this. Map() is not the correct way to do this either i think. What do you all think? I couldn't find a correct way to do this on the forum.
i was thinking:
18 is the amount of images next to each other.
for ( int x = 0; x <18; x++ ) {
if (mouseX <= x*50 && mouseX <= x*50){
println("range "+x*50);
x=18;
}
}
but i think it's wrong :)
1
