Thread: Creating a simple Windows game

  1. #1
    Registered User
    Join Date
    Aug 2006

    Creating a simple Windows game

    Hello everyone,

    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:

    int main(array<System::String ^> ^args)
    	// Enabling Windows XP visual effects before any controls are created
    	// Create the main window and run it
    	Application::Run(gcnew Form1());
    	return 0;
    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?

    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??


  2. #2
    Registered User
    Join Date
    Sep 2006
    The first thing to notice is that this is *not* the Windows programming forum, and it is not the C++ forum, either.

    Please go to the right forum section.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Profiler Valgrind
    By afflictedd2 in forum C++ Programming
    Replies: 4
    Last Post: 07-18-2008, 09:38 AM
  2. 2D RPG Online Game Project. 30% Complete. To be released and marketed.
    By drallstars in forum Projects and Job Recruitment
    Replies: 2
    Last Post: 10-28-2006, 12:48 AM
  3. Simple Game Engine Programming
    By AoA in forum Tech Board
    Replies: 1
    Last Post: 05-26-2006, 12:50 AM
  4. beach bar (sims type game)
    By DrKillPatient in forum Game Programming
    Replies: 1
    Last Post: 03-06-2006, 01:32 PM
  5. Menu Item Caption - /a for right aligned Accelerator?
    By JasonD in forum Windows Programming
    Replies: 6
    Last Post: 06-25-2003, 11:14 AM