Hey, I'm working on a Paint program. I've never built a proper program before so I was wondering how I should go about structuring an actual piece of software. I'm trying to a make a simple paint application (like MS paint) using C++ and the SDL library.

Right now, I'm thinking along the lines of having two main objects, a Screen and a Handler. The Handler waits on the Screen class for events and processes the events and updates the Screen.

Something like this

class screen{} Screen;
class handler{
[INDENT]start(){
[INDENT]while(1){
[INDENT]drawscreen()
processevent()[/INDENT]
}[/INDENT]
}[/INDENT]
}

That looks very simple. Is this a scalable way of doing things? How I render things like lines and circles? Do I make a Line class and 'add' it to the screen, or just 'tell' the screen to draw a line? These are the kinds of questions I have. Any ideas?

Wow! Thanks!
Does this mean that things like toolbars would come under the Model or the View. For the actual drawing area, there's a model, thats fine. But for things like toolbars, is that a model or a view?

I was also wondering if storing all the drawing could be nicely done using XML?

> Does this mean that things like toolbars would come under the Model or the View
in general, *all* user interface elements (toolbars,statusbars,menu etc) would be part of the 'view'.

> I was also wondering if storing all the drawing could be nicely done using XML?
yes, that is the modern approach. (and the persistence/data access layer is encapsulated by the 'model'.)

This article has been dead for over six months. Start a new discussion instead.