We are about to switch to a new forum software. Until then we have removed the registration on this forum.
I'd like to add a feature to increase the brush size with the up and down arrows (im using ellipse's), and also make a feature where I can click a triangle which ive made already to change the shape of the brush. Ive tried but cant figure it out. Any help would be appreciated.
Answers
It wouldn't be easier if you show your code or your attempt.
1.
Now for cursor use a function keyPressed () :
use the float variable
diameter
in your ellipse command (your brush size)2.
Triangle
When the three corners of the triangle are stored in a database or you know them as variables or numbers in your code you can calculate the middle of the triangle by adding the three X values and divide by 3 and repeat for y values.
Then use
dist()
to calculate if the mouse is inside the triangle:See reference for
dist()
:I only show the principle here you have to write it yourself. Especially declaring variables.
Chrisir ;-)
[EDITED]
@djamboo --see
keyCode
in the references:How to change a variable with UP / DOWN: