main.cpp File Reference

Allacrost initialization code and main game loop. More...

#include <ctime>
#include "utils.h"
#include "defs.h"
#include "main_options.h"
#include "audio.h"
#include "video.h"
#include "input.h"
#include "script.h"
#include "system.h"
#include "global.h"
#include "mode_manager.h"
#include "boot.h"
#include "map.h"

Include dependency graph for main.cpp:

Go to the source code of this file.

Functions

bool InitializeEngine ()
 Initializes all engine components and makes other preparations for the game to start.
int32 main (int32 argc, char *argv[])
void QuitAllacrost ()
 Frees all data allocated by Allacrost by destroying the singleton classes.


Detailed Description

Allacrost initialization code and main game loop.

****************************************************************************

Author:
Tyler Olsen, roots@allacrost.org
The code in this file is the first to execute when the game is started and the last to execute before the game exits. The core engine of Allacrost uses time-based updating, which means that the state of the game is updated based on how much time has expired since the last update.

The main game loop consists of the following steps.

  1. Render the newly drawn frame to the screen.
  2. Collect information on new user input events.
  3. Update the main loop timer.
  4. Update the game status based on how much time expired from the last update.

Definition in file main.cpp.


Function Documentation

bool InitializeEngine (  ) 

Initializes all engine components and makes other preparations for the game to start.

Returns:
True if the game engine was initialized successfully, false if an unrecoverable error occured

Definition at line 98 of file main.cpp.

References hoa_audio::AudioManager, hoa_defs::BindEngineToLua(), hoa_global::GlobalManager, hoa_system::GameSystem::InitializeTimers(), hoa_input::InputManager, hoa_video::GameVideo::LoadFont(), hoa_video::GameVideo::LoadMenuSkin(), hoa_mode_manager::ModeManager, hoa_script::ScriptManager, hoa_video::GameVideo::SetFontShadowStyle(), hoa_video::GameVideo::SetFontShadowXOffset(), hoa_video::GameVideo::SetFontShadowYOffset(), hoa_global::GameGlobal::SingletonInitialize(), hoa_input::GameInput::SingletonInitialize(), hoa_system::GameSystem::SingletonInitialize(), hoa_mode_manager::GameModeManager::SingletonInitialize(), hoa_script::GameScript::SingletonInitialize(), hoa_audio::GameAudio::SingletonInitialize(), hoa_video::GameVideo::SingletonInitialize(), hoa_system::SystemManager, hoa_video::VIDEO_TEXT_SHADOW_BLACK, and hoa_video::VideoManager.

Referenced by main().

Here is the call graph for this function:

int32 main ( int32  argc,
char *  argv[] 
)

Definition at line 219 of file main.cpp.

References hoa_audio::AudioManager, hoa_video::GameVideo::Clear(), hoa_video::GameVideo::Display(), hoa_mode_manager::GameModeManager::Draw(), hoa_input::GameInput::EventHandler(), hoa_system::GameSystem::GetUpdateTime(), InitializeEngine(), hoa_input::InputManager, hoa_mode_manager::ModeManager, hoa_system::GameSystem::NotDone(), hoa_main::ParseProgramOptions(), QuitAllacrost(), hoa_system::SystemManager, hoa_mode_manager::GameModeManager::Update(), hoa_audio::GameAudio::Update(), hoa_system::GameSystem::UpdateTimers(), and hoa_video::VideoManager.

Here is the call graph for this function:

void QuitAllacrost (  ) 

Frees all data allocated by Allacrost by destroying the singleton classes.

Note:
Do not attempt to call or otherwise reference this function. It is for use in the application's main() function only.
Deleteing the singleton class objects will free all of the memory that the game uses. This is because all other classes and data structures in Allacrost are managed by these singletons either directly or in directly. For example, BattleMode is a class object that is managed by the GameModeManager class, and thus the GameModeManager destructor will also invoke the BattleMode destructor (as well as the destructors of any other game modes that exist).

Definition at line 75 of file main.cpp.

Referenced by main().


Generated on Fri Jul 6 23:11:52 2007 for Hero of Allacrost by  doxygen 1.5.1