Jump to content
Sign in to follow this  
  • entries
    292
  • comments
    557
  • views
    154335

Lessons Learned

Sign in to follow this  
TANSTAAFL

88 views

In playing with the PopCap framework, the whole "how things should be done" becomes readily apparent.

In the demo programs, there are the following files:

A file containing the WinMain function. This WinMain function is the same in all demos. This means, IMO, that it should be hidden in the framework, but that's just me.
A file containing the GameApp class, which represents the application as a whole. This class derives from SexyAppBase, and is the "true" entry point for the code as far as the developer is concerned.
A file containing the Board class, which derives from Widget. In more complex examples, other files containing other Widget derived classes also exist. A Widget is simply something that the player can interact with... anything from a playing field to a button to a checkbox. Often there is a TitleScreen class.
For more complex examples, a file that manages all of the resources for an application, typically called Res.h/cpp.

Here is what I have learned:

* Each of the Widget derived classes for your game should mirror the various application states.
* The state of the application should be managed from within the GameApp class.
* When transitioning from one state to another, first remove the current Widget from the widget manager, then add the new Widget to the widget manager.
* Any auxiliary widgets should be added and removed to the widget manager by the parent widgets AddedToManager and RemovedFromManager functions.
* Any auxiliary widget initialization should be done during AddedToManager function, by checking the appropriate variables for NULL.
* Use a resource manifest.
* Use static members of a class to store resources and other shared data.
* Separate resources by type: image, sound, font.
* Use enumerations to differentiate between various resources and application states.
* You may want to add a state stack to the GameApp class, as it makes certain state manipulations easier(like context sensitive help, for example).
Sign in to follow this  


0 Comments


Recommended Comments

There are no comments to display.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!