building a program

Hello

I have been through many of the NeHe OpenGL tutorials now and feel I have a good basis for starting my project.
My problem at the moment is thinking about the structure of the program. I intend to have an initial welcome and menu screen before the user progresses to the main part of the program by clicking on the relevant button.
Should I create a new C++ source file for each screen or just do it all in one? My reasoning here is that there will be different uses for keyboard presses on different screens and it might get a bit complicated to keep track of what’s going on if it’s all kept in one source file.
What is the usual practise for this sort of thing, or what would you advise?
This is my first proper C++ program as well as my first OpenGL program! I have done some C, Java and Eiffel (the latter 2 being OO languages) so am not finding the C++ too difficult.

thanks

Gareth
<><

I have to agree once your source file has reached a large amont of code, it is easier to handle if you break it down to multiple files.

main.c // all things start from here.

display.c // all your display routines.

mouse.c // all your mouse routines.

etc.

You can make you a state list, as the program goes through diffent states, functions or enable or disabled.

state = 0; Display title screen.
state = 1; Display user options.
state = 2; Do demo scene 1.
etc.

my_mouse()
{
if (state = 0)
{
//state 0 mouse functions.
}

}
repeat for keyboard, etc.

Originally posted by dfanuk:
[b]Hello

I have been through many of the NeHe OpenGL tutorials now and feel I have a good basis for starting my project.
My problem at the moment is thinking about the structure of the program. I intend to have an initial welcome and menu screen before the user progresses to the main part of the program by clicking on the relevant button.
Should I create a new C++ source file for each screen or just do it all in one? My reasoning here is that there will be different uses for keyboard presses on different screens and it might get a bit complicated to keep track of what’s going on if it’s all kept in one source file.
What is the usual practise for this sort of thing, or what would you advise?
This is my first proper C++ program as well as my first OpenGL program! I have done some C, Java and Eiffel (the latter 2 being OO languages) so am not finding the C++ too difficult.

thanks

Gareth
<><[/b]