Drawing question
Posted: Fri May 24, 2013 3:33 pm
Hi!
I have a questions regards drawing. I hope someone can help me on this.
What I want to create is that if I press a mousebutton the drawing starts.
Then it draw a line from the starting point at which I pressed the mouse to the mouse position.
At somepoint at the screen the starting point changed. Then after this the line has to be draw from this new starting point to the mouse.
And if I release the mouse button its finished.
My code for drawing is:
if (draw == 1) {
if (startdraw == 1) { // check if started the drawing
setpen(10, 10, 10, 0.0, 3);
erase(10,10,10,1);
moveto (mstartx,mstarty);
screen_to_actor(&xmouse, &ymouse);
lineto (xmouse,ymouse);
} else {
startdraw = 1;
screen_to_actor(&xmouse, &ymouse);
moveto (xmouse,ymouse);
mstartx = xmouse;
mstarty = ymouse;
}
}
So it means that I clear the last lines and draw a new line from starting point to the mouse position.
But at some checkpoints I want not to remove the line.
It means I want a line from point 1 to point 2 and then to point 3 and to point 4 ...
Any idea how to solve it?
Thx,
I have a questions regards drawing. I hope someone can help me on this.
What I want to create is that if I press a mousebutton the drawing starts.
Then it draw a line from the starting point at which I pressed the mouse to the mouse position.
At somepoint at the screen the starting point changed. Then after this the line has to be draw from this new starting point to the mouse.
And if I release the mouse button its finished.
My code for drawing is:
if (draw == 1) {
if (startdraw == 1) { // check if started the drawing
setpen(10, 10, 10, 0.0, 3);
erase(10,10,10,1);
moveto (mstartx,mstarty);
screen_to_actor(&xmouse, &ymouse);
lineto (xmouse,ymouse);
} else {
startdraw = 1;
screen_to_actor(&xmouse, &ymouse);
moveto (xmouse,ymouse);
mstartx = xmouse;
mstarty = ymouse;
}
}
So it means that I clear the last lines and draw a new line from starting point to the mouse position.
But at some checkpoints I want not to remove the line.
It means I want a line from point 1 to point 2 and then to point 3 and to point 4 ...
Any idea how to solve it?
Thx,