Turing Paint Function Help
Author |
Message |
born130
|
Posted: Fri Dec 26, 2003 3:59 pm Post subject: Turing Paint Function Help |
|
|
Hello,
I have been having problems on how to draw a box similar to a the way it is done in a paint program.
The problem is how do I get the outline of the box to appear without erasing what's underneath.
Also does anyone know how I can make an undo function?
Thanks,
born130 |
|
|
|
|
|
Sponsor Sponsor
|
|
|
Thuged_Out_G
|
Posted: Fri Dec 26, 2003 5:44 pm Post subject: (No subject) |
|
|
code: |
var x,y,button:int
loop
Mouse.Where(x,y,button)
if button=1 then
drawbox(x,y,x,y,1)
end if
end loop
|
that should do it just like in paint, but the box wont stay once you let go of the mouse(i think)
so youll have to figure that out on your own
making an undo function...hmm, to undo what?
if you wanna remove something already drawn, the best solution i can think of is to draw over it using the background color...so store the x,y coords in a variable, and then when you want to draw over that shape, just draw the exzact same shape, but make it the background color...hope that helps |
|
|
|
|
|
Tony
|
Posted: Fri Dec 26, 2003 5:54 pm Post subject: (No subject) |
|
|
here's what you do.
before the tool is used, you take a screen shot of your drawing field Pic.New()
then you draw your outlines and whatnot. You can always just load the picture over the drawing field to get rid of outlines and what not. When tool's position is ready, you draw your box. Now this is where undo comes in. You can "undo" the tool and just redraw the picture you took earlier. Otherwise if the tool is is used again, a new picture is taken. |
Tony's programming blog. DWITE - a programming contest. |
|
|
|
|
|
|