CoreApp Class Reference

#include <CoreApp.h>

Inheritance diagram for CoreApp:

ConApp GUIApp List of all members.

Public Member Functions

 ENABLE_RUNTIME_CLASSTYPE ()
 CoreApp (int argc, const char *const *argv)
virtual ~CoreApp ()
virtual void run ()=0
virtual void paint ()=0
virtual bool isPainting ()
virtual void ForceQuit ()
void startup ()
GameInfogetGameInfo () const
GameInfogetGameInfo (Pentagram::istring game) const
virtual void helpMe ()
bool help () const
bool quiet () const
bool vquiet () const

Static Public Member Functions

static CoreAppget_instance ()

Protected Member Functions

virtual void DeclareArgs ()
void setupGameList ()
GameInfogetDefaultGame ()
bool setupGame (GameInfo *info)
void killGame ()

Protected Attributes

bool isRunning
std::map< Pentagram::istring,
GameInfo * > 
games
GameInfogameinfo
FileSystemfilesystem
ConfigFileManagerconfigfileman
SettingManagersettingman
Args parameters
std::string oGamename
bool oHelp
bool oQuiet
bool oVQuiet

Static Protected Attributes

static CoreAppapplication = 0

Private Member Functions

virtual void sysInit ()
void ParseArgs (int argc, const char *const *argv)
bool getGameInfo (Pentagram::istring &game, GameInfo *gameinfo)
void setupGamePaths ()
void setupVirtualPaths ()
void loadConfig ()

Private Attributes

int argc
const char *const * argv

Detailed Description

Definition at line 41 of file CoreApp.h.


Constructor & Destructor Documentation

CoreApp::CoreApp ( int  argc,
const char *const *  argv 
)

Definition at line 46 of file CoreApp.cpp.

References application.

CoreApp::~CoreApp (  )  [virtual]

Definition at line 55 of file CoreApp.cpp.

References application, configfileman, filesystem, gameinfo, games, and settingman.


Member Function Documentation

void CoreApp::DeclareArgs (  )  [protected, virtual]

Declare commandline arguments. Should call parent class' DeclareArgs().

Reimplemented in ConApp, and GUIApp.

Definition at line 99 of file CoreApp.cpp.

References Args::declare(), oGamename, oHelp, oQuiet, oVQuiet, and parameters.

Referenced by GUIApp::DeclareArgs(), ConApp::DeclareArgs(), and startup().

CoreApp::ENABLE_RUNTIME_CLASSTYPE (  ) 

Reimplemented in GUIApp.

virtual void CoreApp::ForceQuit (  )  [inline, virtual]

Definition at line 54 of file CoreApp.h.

References isRunning.

Referenced by QuitGump::ChildNotify(), GUIApp::handleEvent(), QuitGump::OnTextInput(), DisasmProcess::run(), and CompileProcess::run().

static CoreApp* CoreApp::get_instance (  )  [inline, static]

Reimplemented in ConApp, and GUIApp.

Definition at line 48 of file CoreApp.h.

References application.

Referenced by Item::canMergeWith(), GameData::getSpeechFlex(), ReadableGump::InitGump(), GameData::loadRemorseData(), GameData::loadTranslation(), GameData::loadU8Data(), U8Game::playCredits(), U8Game::playIntroMovie(), DisasmProcess::run(), CompileProcess::run(), and GameData::setupFontOverrides().

GameInfo * CoreApp::getDefaultGame (  )  [protected]

return default game

Returns:
0 if no default game (implies go to Pentagram Menu)

Definition at line 237 of file CoreApp.cpp.

References SettingManager::DOM_GLOBAL, games, SettingManager::get(), getGameInfo(), oGamename, perr, pout, and settingman.

Referenced by GUIApp::startup().

bool CoreApp::getGameInfo ( Pentagram::istring game,
GameInfo gameinfo 
) [private]

Fill a GameInfo struct for the give game name

Parameters:
game The id of the game to check (from pentagram.cfg)
gameinfo The GameInfo struct to fill
Returns:
true if detected all the fields, false if detection failed

! TODO: version parsing

Definition at line 322 of file CoreApp.cpp.

References configfileman, GameDetector::detect(), GameInfo::GAME_PENTAGRAM_MENU, GameInfo::GAME_REMORSE, GameInfo::GAME_U8, GameInfo::GAME_UNKNOWN, gameinfo, GameInfo::GAMELANG_ENGLISH, GameInfo::GAMELANG_FRENCH, GameInfo::GAMELANG_GERMAN, GameInfo::GAMELANG_JAPANESE, GameInfo::GAMELANG_SPANISH, GameInfo::GAMELANG_UNKNOWN, gametype, ConfigFileManager::get(), GameInfo::language, GameInfo::name, ToLower(), GameInfo::type, PentagramVersion::version, and GameInfo::version.

GameInfo * CoreApp::getGameInfo ( Pentagram::istring  game  )  const

Get GameInfo for other configured game, or 0 for an invalid name.

Definition at line 454 of file CoreApp.cpp.

References games.

GameInfo* CoreApp::getGameInfo (  )  const [inline]

Get current GameInfo struct.

Definition at line 61 of file CoreApp.h.

References gameinfo.

Referenced by GUIApp::ConCmd_listGames(), GameWidget::GameWidget(), getDefaultGame(), GameData::getSpeechFlex(), GameData::loadRemorseData(), GameData::loadTranslation(), GameData::loadU8Data(), U8Game::playCredits(), U8Game::playIntroMovie(), GUIApp::run(), GameData::setupFontOverrides(), setupGameList(), GUIApp::startupGame(), GUIApp::startupPentagramMenu(), and U8Game::U8Game().

bool CoreApp::help (  )  const [inline]

Definition at line 68 of file CoreApp.h.

References oHelp.

void CoreApp::helpMe (  )  [virtual]

Reimplemented in ConApp.

Definition at line 446 of file CoreApp.cpp.

References con, and Console::Print().

Referenced by ConApp::helpMe(), and startup().

virtual bool CoreApp::isPainting (  )  [inline, virtual]

Reimplemented in GUIApp.

Definition at line 52 of file CoreApp.h.

void CoreApp::killGame (  )  [protected]

kill current gameinfo

Definition at line 304 of file CoreApp.cpp.

References ConfigFileManager::clearRoot(), configfileman, SettingManager::DOM_GLOBAL, filesystem, gameinfo, FileSystem::RemoveVirtualPath(), SettingManager::setCurrentDomain(), and settingman.

Referenced by GUIApp::shutdownGame().

void CoreApp::loadConfig (  )  [private]

load configuration files

Definition at line 176 of file CoreApp.cpp.

References FileSystem::AddVirtualPath(), SettingManager::DOM_GLOBAL, filesystem, SettingManager::get(), perr, pout, SettingManager::readConfigFile(), and settingman.

Referenced by startup().

virtual void CoreApp::paint (  )  [pure virtual]

Implemented in ConApp, and GUIApp.

void CoreApp::ParseArgs ( int  argc,
const char *const *  argv 
) [private]

parse commandline arguments

Definition at line 441 of file CoreApp.cpp.

References parameters, and Args::process().

Referenced by startup().

bool CoreApp::quiet (  )  const [inline]

Definition at line 69 of file CoreApp.h.

References oQuiet.

virtual void CoreApp::run (  )  [pure virtual]

Implemented in ConApp, and GUIApp.

bool CoreApp::setupGame ( GameInfo info  )  [protected]

Setup up a game

Returns:
false if failed (implies go to Pentagram Menu)

Definition at line 287 of file CoreApp.cpp.

References gameinfo, GameInfo::getPrintDetails(), GameInfo::name, pout, and setupGamePaths().

Referenced by GUIApp::run(), GUIApp::startup(), and GUIApp::startupPentagramMenu().

void CoreApp::setupGameList (  )  [protected]

Definition at line 209 of file CoreApp.cpp.

References con, games, getGameInfo(), GameInfo::getPrintDetails(), SettingManager::listGames(), MM_INFO, Console::Print(), Console::Printf(), and settingman.

Referenced by GUIApp::startup().

void CoreApp::setupGamePaths (  )  [private]

Setup the virtual game paths for the current game (set in gameinfo) Specifically, and

!FIXME (u8)

Definition at line 393 of file CoreApp.cpp.

References FileSystem::AddVirtualPath(), con, SettingManager::DOM_GAME, filesystem, gameinfo, SettingManager::get(), FileSystem::MkDir(), MM_INFO, GameInfo::name, Console::Printf(), SettingManager::setCurrentDomain(), SettingManager::setDomainName(), settingman, and Animation::work.

Referenced by setupGame().

void CoreApp::setupVirtualPaths (  )  [private]

setup default virtual paths (, )

Definition at line 121 of file CoreApp.cpp.

References FileSystem::AddVirtualPath(), filesystem, macosxResourcePath(), and pout.

Referenced by startup().

void CoreApp::startup (  ) 

Startup the application. This will prepare the application for run(). Should call parent class' startup().

Reimplemented in ConApp, and GUIApp.

Definition at line 71 of file CoreApp.cpp.

References argc, argv, con, DeclareArgs(), helpMe(), loadConfig(), MM_ALL, MM_INFO, MM_MAJOR_WARN, MM_MINOR_ERR, MM_MINOR_WARN, oHelp, oQuiet, oVQuiet, ParseArgs(), Console::setMsgMask(), setupVirtualPaths(), and sysInit().

Referenced by GUIApp::startup(), and ConApp::startup().

void CoreApp::sysInit (  )  [private, virtual]

start filesystem, kernel, config

Definition at line 108 of file CoreApp.cpp.

References configfileman, SettingManager::DOM_GLOBAL, filesystem, gameinfo, SettingManager::setCurrentDomain(), SettingManager::setDomainName(), and settingman.

Referenced by startup().

bool CoreApp::vquiet (  )  const [inline]

Definition at line 70 of file CoreApp.h.

References oVQuiet.


Member Data Documentation

CoreApp * CoreApp::application = 0 [static, protected]

Definition at line 90 of file CoreApp.h.

Referenced by ConApp::ConApp(), CoreApp(), GUIApp::get_instance(), get_instance(), ConApp::get_instance(), GUIApp::GUIApp(), and ~CoreApp().

int CoreApp::argc [private]

Definition at line 93 of file CoreApp.h.

Referenced by startup().

const char* const* CoreApp::argv [private]

Definition at line 94 of file CoreApp.h.

Referenced by startup().

ConfigFileManager* CoreApp::configfileman [protected]

Definition at line 85 of file CoreApp.h.

Referenced by getGameInfo(), killGame(), GUIApp::LoadConsoleFont(), GUIApp::startupGame(), sysInit(), and ~CoreApp().

FileSystem* CoreApp::filesystem [protected]

Definition at line 84 of file CoreApp.h.

Referenced by GUIApp::GraphicSysInit(), killGame(), loadConfig(), GUIApp::loadGame(), GUIApp::saveGame(), setupGamePaths(), setupVirtualPaths(), GUIApp::startup(), ConApp::startup(), sysInit(), and ~CoreApp().

GameInfo* CoreApp::gameinfo [protected]

Definition at line 81 of file CoreApp.h.

Referenced by GUIApp::ConCmd_changeGame(), getGameInfo(), killGame(), GUIApp::loadGame(), GUIApp::saveGame(), setupGame(), setupGamePaths(), GUIApp::startupGame(), GUIApp::startupPentagramMenu(), sysInit(), and ~CoreApp().

std::map<Pentagram::istring, GameInfo*> CoreApp::games [protected]

Definition at line 80 of file CoreApp.h.

Referenced by GUIApp::ConCmd_listGames(), getDefaultGame(), getGameInfo(), setupGameList(), and ~CoreApp().

bool CoreApp::isRunning [protected]

Definition at line 78 of file CoreApp.h.

Referenced by GUIApp::ConCmd_quit(), ForceQuit(), GUIApp::handleEvent(), GUIApp::run(), and ConApp::run().

std::string CoreApp::oGamename [protected]

Definition at line 133 of file CoreApp.h.

Referenced by DeclareArgs(), and getDefaultGame().

bool CoreApp::oHelp [protected]

Definition at line 134 of file CoreApp.h.

Referenced by DeclareArgs(), help(), and startup().

bool CoreApp::oQuiet [protected]

Definition at line 135 of file CoreApp.h.

Referenced by DeclareArgs(), quiet(), and startup().

bool CoreApp::oVQuiet [protected]

Definition at line 136 of file CoreApp.h.

Referenced by DeclareArgs(), startup(), and vquiet().

Args CoreApp::parameters [protected]

Definition at line 88 of file CoreApp.h.

Referenced by DeclareArgs(), ConApp::DeclareArgs(), and ParseArgs().

SettingManager* CoreApp::settingman [protected]

Definition at line 86 of file CoreApp.h.

Referenced by GUIApp::changeVideoMode(), GUIApp::ConCmd_listGames(), getDefaultGame(), GUIApp::GraphicSysInit(), killGame(), loadConfig(), GUIApp::loadGame(), setupGameList(), setupGamePaths(), GUIApp::startup(), GUIApp::startupGame(), sysInit(), and ~CoreApp().


The documentation for this class was generated from the following files:
Generated on Fri Jul 27 22:28:59 2007 for pentagram by  doxygen 1.4.7