|  | 
 
Hey all,  I have been making image editors in Blitz for a while now, and I thought I would show you lot how to create on of my simpler ones, cut down, this isn't going to be an amasing piece of code, grant it, but it will be tbe basics you could work on to create somthing like my current EarthEdit. OK, first off let's do the obvious stuff: 
 OK, now you want to see a mouse cursor, let's be fancy and use a cross intead of just a dot. I'll make this a function, for the nice code. 
 And don't forget to add in DrawMouse() under CLS in the main code. Now you want to add the main code for drawing, this is simple to an exent, you simply put in a check for a mouse button, and then a plot. But unfortunatally there is a complication. At the moment you have a clear screen running, so anything drawn will dissapear. For a while my painting apps had no cursor, as then there was no need for the CLS but then I hit upon the answer, and I'm going to save you the trouble of finding it. The method used is to capture the screen at the end of your code, then plonk it in again in the next loop. Unfortunatally, this also captures the cursor, but again, the soloution is there, you can just simply make sure that the DrawMouse() command is just before the flip. This way it captures the image without the mouse. OK, After all of that you probably want some code now, so here it is: 
 OK, So there you are, it isn't much, but it's easy to add in things like other colours or tools. Try experimenting, Saving is also easy, along with loading. Here are some little funcions you could use if you want: 
 
 
 
I hope that helps, All the best. For a printable copy of this article, please click HERE. 
 This site is Copyright© 2000-2004, BlitzCoder. All rights reserved.   |