Creating a simple Windows game
I am attempting to write a game in C++, using Visual Studio 2008. The game has minimal graphics, with more of a simple button / text GUI, and as such I will be using Windows Forms.
However, I am having some trouble getting started. When I create a normal Windows Forms project using the Visual Studio project wizard, MyProject.cpp initially has the following code:
In this arrangement, Form1 would have to contain all of my other objects in the program, because it is the only object that is created at the start. However, it doesn't seem very elegant to have a Form as the main component, when all the form is doing is displaying a user interface. I want something going on in the background which actually controls the program. For example, I want to have a class called "Game" which will itself contain an instance of Form1. In this way, I can say something like Game.Run(), and it will create a new instance of Form1, and display it. Is this the normal way of doing things?
int main(array<System::String ^> ^args)
// Enabling Windows XP visual effects before any controls are created
// Create the main window and run it
The problem with this, however, is that Windows Forms are managed, and my Game class is unmanaged, so this does not work. But I want to keep Game unmanaged...
Basically, what I want to know is what is the standard way of creating such a program - do most people leave Form1 as the main component of the program, which loads all the other objects, or do people create a class such as Game, which itself create a form, along with all the other necessary objects??