Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Turing Paint Function Help
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
born130




PostPosted: 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
Sponsor
sponsor
Thuged_Out_G




PostPosted: 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




PostPosted: 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.
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 3 Posts ]
Jump to:   


Style:  
Search: