Sourcecode basic outline
A quick guide to understanding the program's structure and get developing fast.
performous' main.cc will initialize all components (create instances of the Game singlethon, screens and song/webserver/playlist objects) and then start the mainloop, the mainloop is pretty basic. The structure is somewhat similar to this:
while(!game.isfinished()) {
- draw
- process input
}
The game object manages the drawing and the input of the game, it was formerly called screenmanager but that name was misleading since it did more than just managing screens. Unfortunately, due to it's history it's still declared in screen.hh
you can obtain a pointer to the Game class with:
Game* gm = Game::getSingletonPtr();
drawing is done with "screens". A "screen" is a class that inherits from the screen class (also declared in screen.hh) and implements a constructor, a "manage-event" function (for input behaviour) a draw function(for drawing stuff onto the screen) and enter() and exit() functions.
A screen is added to the game with:
gm.addScreen(new ScreenIntro("Intro", audio));
screens are Identified with strings, you can switch screens by obtaining it from the Game singlethon and cast it to the appropriate type like so:
Game* gm = Game::getSingletonPtr(); Screen* s = gm->getScreen("Players"); ScreenPlayers* ss = dynamic_cast<ScreenPlayers*> (s);
Game->activate_screen does what's listed on the package ;-) most screens declare their assets in theme.hh/theme.cc
settings are saved in the config system, the layout of the config is saved in /data/config/schema.xml
you can get or set a config entry with config["game/karaoke_mode"]
the current settings will only be saved when ctrl+s is pressed at the settings screen. Otherwise the change is just temporarily.
the songs object is our main song database, when initialized it creates it's own thread that scans for songs on the hard drive, the songs object works just like a regular array, songs[number]
returns a boost::shared_ptr. with 'setFilter(std::string const& regex);' you can give it a search string, the size of the array is adjusted and songs[number]
will only contain songs that match the search query.
The songs object is thread-safe.
The singing screen is where it all happens, the current song can be changed with ScreenSongs::setSong()
as described in the example below
Game* gm = Game::getSingletonPtr(); ScreenSing& ss = dynamic_cast<ScreenSing&>(*gm->getScreen("Sing")); ss.setSong(gm->getCurrentPlayList().getNext()); gm->activateScreen("Sing");
the singing screen will determine what kind of song it is and start the appropriate drawing code, the drawing code can be found as following:
- karaoke/singing -> layout-singer.hh & layout-singer.cc together with notegraph
- Dance -> dancegraph.hh & dancegraph.cc
- guitar -> guitargraph.cc & guitargraph.hh together with instrumentgraph
- drums -> instrumentgraph.cc & instrumentgraph.hh
- Download & Install
- Songs
- Keys
- Gameplay
- Tools
- Composer (Performous)
- SingStar ripper (Performous)
- Separation tools
- Song creating tools
- Troubleshooting
- Audio Configuration
- Audio equipment guide
- Controller Configuration
- Command Line Arguments
- Video Configurations
- Player Configuration
- Random Backgrounds
- Webcam Background
- Microphone Pass-through
- Real karaoke
- Stereoscopic 3D
- Theming
- Ultrastar .txt Tags