Hi dudes, i was wondering how to do this. Well i can imagine a way, but i think it’s too “brute”.
Lets explain thigs a little bit better:
Basically i have a program where you have a canvas (passive rendered) and you can add there squares or circles. So you choose the shape and then click on the canvas to draw it where you want. But when you draw the shape, your mose goes back to its normal behaviour (i.e. dont draw anything). But the idea is that when you click an existing shape, you can modify its radius, width and or height.
So basically i was thinking in a big arrayList with all my shapes (with their boundary rectangle) and when the user clicks on the canvas retrieve the coords of the mouse and check
if (mouse.x < shape.x + shape.width && mouse.x > shape.x && mouse.y < shape.y + shape.width && mouse.y > shape.y)
finallyYouClickedTheF***ingShape(shape);
So you guys that are smarter and have more imagination, should this be OK for rectangles and or circles? Keep in mind that the rectangles can be rotated in any angle (hopefully i dont need to do any trig here :P)
Could i create a rectangle surrounding the mouse and use the intersects function ? Does this function only consider rectangles at 0º ?
Any suggestions on how to implement this?
Thanks in advance