Code Walkthrough

If you haven't already, skim over the StepMania class hierarchies diagrams. The Actor and Screen hierarchies are of particular interest.

Contents

Style Guidelines

  • Be sure that you have tab stops set to 8 spaces, not 4 (the default in Visual Studio).
  • Please try to maintain a style consistent with the code that you are editing.

Important Files

Actor

Actor.h/cpp

Actor is the base class for most elements you see on the screen. Actors have a position, rotation, color, and other properties. Update() and Draw() are called on them once per frame.

Sprite

Actor.h/cpp

Sprite is an Actor that draws a bitmap. The logo on the title screen and the scrolling arrows during gameplay are both examples.


BitmapText

BitmapText.h/cpp

BitmapText is an Actor that has a text property. It uses a bitmap font to draw characters to the screen every frame. The credits text at the bottom of the screen is an example of a BitmapText element.


ActorFrame

ActorFrame.h/cpp

An ActorFrame is an Actor that contains other Actors. First, Actors are added to an ActorFrame. Then, calling Update() or Draw() on an ActorFrame will recursively call Update() and Draw() on all children of the ActorFrame.


Screen

Screen*.h/cpp

A Screen is an ActorFrame that also handles input and contains game logic. To move Actors or make other things happen when the user presses a button, insert some logic in a Screen's Input() method.

ThemeManager

ThemeManager.h/cpp

ThemeManager is the global singleton object that is responsible for feeding graphics, sound, animation files, and screen order information to the game code.

All theme files reside in the Themes/ directory. metrics.ini is the central theme file and defines things like screen order and what choices are available on each screen. When Screens are loaded, they ask theme manager ThemeManager which menu choices, graphics, animations, and sounds to display to the user.


File access

StepMania abstracts file access. The most typical way to read or write a file is through RageFile class.

To perform other, less-common file operations like Move and Delete, see RageFileManager.cpp/h (the global singleton FILEMAN).

Another useful function is GetDirListing, which enumerates files in the supplied directory and also accepts wildcards.

Language Translations

  • EN is the master language.
  • Tools export CSV files for each language that contain strings that need translating for that language.
  • Tools determined that a string needs translation for a particular language if it exists in en.ini but not in the particular translation's ini.

So,

  • if you add a new string, just fill in EN and leave the others blank, and some future translator can fill in the appropriate phrasing for their language of choice.
  • If you modify a string in EN (other than fixing a small typo), delete the translations in all other languages since they are no longer valid.
  • If you delete a string in EN, delete it from all other languages.

Thanks to

Pair.com (donated web hosting)