Jump to content
  • Advertisement
Sign in to follow this  
  • entries
  • comments
  • views

Lessons Learned

Sign in to follow this  


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  


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.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!