Location Relativity #
I found out what was wrong with the location getting function. GetMouse returns the coordinates in relation to the current port, and I had placed a SetGWorld before I called it. To make sure that I'll always get the right coordinates I've done my GetClickLocation function like this
SAVEGWORLD
SetPort(window) // this is the parent window
RESTOREGWORLD
I don't think that setting and restoring the current port is very cpu intensive, so it shouldn't make much of a difference.
Using this I fixed the pen drawing code, and finished the filling one too. Then I split up the HandleDrawing function into different ones, one for each tool.
The last thing I did was to add an eye dropper tool. It was simply a matter of setting the port to the current icon, doing a GetCPixel, and putting the returned value into the foreground color of the parent class.
Post a Comment