FIFE
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
FIFE::Engine Class Reference

Engine acts as a controller to the whole system Responsibilities of the engine are: More...

#include <engine.h>

+ Collaboration diagram for FIFE::Engine:

Public Member Functions

 Engine ()
 Constructor. More...
 
virtual ~Engine ()
 Destructor. More...
 
EngineSettingsgetSettings ()
 Gets settings class for engine. More...
 
const DeviceCapsgetDeviceCaps () const
 Gets device capabilities. More...
 
void changeScreenMode (const ScreenMode &mode)
 Changes the screen mode. More...
 
void init ()
 Initializes the engine. More...
 
void destroy ()
 Explicit destruction of engine. More...
 
void initializePumping ()
 Initializes the continuous processing of the engine Call this only once in your program. More...
 
void finalizePumping ()
 Finalizes the continuous processing of the engine Call this only once in your program, after you have called initializePumping + (pump() * N times) More...
 
void pump ()
 Runs one cycle for the engine. More...
 
SoundManagergetSoundManager () const
 Provides access point to the SoundManager. More...
 
EventManagergetEventManager () const
 Provides access point to the EventManager. More...
 
TimeManagergetTimeManager () const
 Provides access point to the TimeManager. More...
 
void setGuiManager (IGUIManager *guimanager)
 Sets the GUI Manager to use. More...
 
IGUIManagergetGuiManager () const
 Provides access point to the GUI Manager. More...
 
ImageManagergetImageManager () const
 Provides access point to the ImageManager. More...
 
SoundClipManagergetSoundClipManager () const
 Provides access point to the SoundClipManager. More...
 
RenderBackendgetRenderBackend () const
 Provides access point to the RenderBackend. More...
 
ModelgetModel () const
 Provides access point to the Model. More...
 
LogManagergetLogManager () const
 Provides access point to the LogManager. More...
 
VFSgetVFS () const
 Provides access point to the VFS. More...
 
CursorgetCursor () const
 Returns cursor used in the engine. More...
 
OffRenderergetOffRenderer () const
 Provides access point to the OffRenderer. More...
 
TargetRenderergetTargetRenderer () const
 Provides access point to the TargetRenderer. More...
 
void addChangeListener (IEngineChangeListener *listener)
 Adds new change listener. More...
 
void removeChangeListener (IEngineChangeListener *listener)
 Removes associated change listener. More...
 

Private Attributes

RenderBackendm_renderbackend
 
IGUIManagerm_guimanager
 
EventManagerm_eventmanager
 
SoundManagerm_soundmanager
 
TimeManagerm_timemanager
 
ImageManagerm_imagemanager
 
SoundClipManagerm_soundclipmanager
 
VFSm_vfs
 
Modelm_model
 
LogManagerm_logmanager
 
Cursorm_cursor
 
bool m_destroyed
 
EngineSettings m_settings
 
DeviceCaps m_devcaps
 
ScreenMode m_screenMode
 
OffRendererm_offrenderer
 
TargetRendererm_targetrenderer
 
std::vector< RendererBase * > m_renderers
 
std::vector
< IEngineChangeListener * > 
m_changelisteners
 

Detailed Description

Engine acts as a controller to the whole system Responsibilities of the engine are:

  • Construct and initialize engine internals
  • Clean-up when the program ends
  • Act as an entry point to the engine subsystems

Definition at line 79 of file engine.h.

Constructor & Destructor Documentation

FIFE::Engine::Engine ( )

Constructor.

Definition at line 92 of file engine.cpp.

References FIFE::LogManager::instance(), and m_logmanager.

FIFE::Engine::~Engine ( )
virtual

Destructor.

Definition at line 295 of file engine.cpp.

References destroy(), and m_destroyed.

Member Function Documentation

void FIFE::Engine::addChangeListener ( IEngineChangeListener listener)

Adds new change listener.

Parameters
listenerto add

Definition at line 366 of file engine.cpp.

References m_changelisteners.

void FIFE::Engine::changeScreenMode ( const ScreenMode mode)

Changes the screen mode.

This should be called instead of the renderer's setScreenMode() function. It takes care of any objects that need to be re-created after switching screen modes.

Parameters
modeA valid ScreenMode retrieved from FIFE::DeviceCaps::getNearestScreenMode()

Definition at line 133 of file engine.cpp.

References FIFE::ScreenMode::getHeight(), FIFE::ScreenMode::getWidth(), FIFE::Cursor::invalidate(), FIFE::ImageManager::invalidateAll(), m_changelisteners, m_cursor, m_guimanager, m_imagemanager, m_renderbackend, FIFE::IGUIManager::resizeTopContainer(), and FIFE::RenderBackend::setScreenMode().

void FIFE::Engine::destroy ( )

Explicit destruction of engine.

Definition at line 301 of file engine.cpp.

References FIFE::_log, FL_LOG, m_cursor, m_destroyed, m_guimanager, m_imagemanager, m_model, m_offrenderer, m_renderbackend, m_renderers, m_soundclipmanager, m_soundmanager, m_targetrenderer, m_timemanager, and m_vfs.

Referenced by ~Engine().

+ Here is the caller graph for this function:

void FIFE::Engine::finalizePumping ( )

Finalizes the continuous processing of the engine Call this only once in your program, after you have called initializePumping + (pump() * N times)

Definition at line 362 of file engine.cpp.

Cursor* FIFE::Engine::getCursor ( ) const
inline

Returns cursor used in the engine.

Definition at line 177 of file engine.h.

References m_cursor.

const DeviceCaps & FIFE::Engine::getDeviceCaps ( ) const

Gets device capabilities.

Definition at line 129 of file engine.cpp.

References m_devcaps.

EventManager* FIFE::Engine::getEventManager ( ) const
inline

Provides access point to the EventManager.

Definition at line 135 of file engine.h.

References m_eventmanager.

IGUIManager* FIFE::Engine::getGuiManager ( ) const
inline

Provides access point to the GUI Manager.

Definition at line 149 of file engine.h.

References m_guimanager.

ImageManager* FIFE::Engine::getImageManager ( ) const
inline

Provides access point to the ImageManager.

Definition at line 153 of file engine.h.

References m_imagemanager.

LogManager* FIFE::Engine::getLogManager ( ) const
inline

Provides access point to the LogManager.

Definition at line 169 of file engine.h.

References m_logmanager.

Model* FIFE::Engine::getModel ( ) const
inline

Provides access point to the Model.

Definition at line 165 of file engine.h.

References m_model.

OffRenderer* FIFE::Engine::getOffRenderer ( ) const
inline

Provides access point to the OffRenderer.

Definition at line 181 of file engine.h.

References m_offrenderer.

RenderBackend* FIFE::Engine::getRenderBackend ( ) const
inline

Provides access point to the RenderBackend.

Definition at line 161 of file engine.h.

References m_renderbackend.

EngineSettings & FIFE::Engine::getSettings ( )

Gets settings class for engine.

Definition at line 125 of file engine.cpp.

References m_settings.

SoundClipManager* FIFE::Engine::getSoundClipManager ( ) const
inline

Provides access point to the SoundClipManager.

Definition at line 157 of file engine.h.

References m_soundclipmanager.

SoundManager* FIFE::Engine::getSoundManager ( ) const
inline

Provides access point to the SoundManager.

Definition at line 131 of file engine.h.

References m_soundmanager.

TargetRenderer* FIFE::Engine::getTargetRenderer ( ) const
inline

Provides access point to the TargetRenderer.

Definition at line 185 of file engine.h.

References m_targetrenderer.

TimeManager* FIFE::Engine::getTimeManager ( ) const
inline

Provides access point to the TimeManager.

Definition at line 139 of file engine.h.

References m_timemanager.

VFS* FIFE::Engine::getVFS ( ) const
inline

Provides access point to the VFS.

Definition at line 173 of file engine.h.

References m_vfs.

void FIFE::Engine::init ( )

Initializes the engine.

Definition at line 151 of file engine.cpp.

References FIFE::_log, FIFE::VFS::addProvider(), FIFE::VFS::addSource(), FIFE::Model::adoptCellGrid(), FIFE::Model::adoptPather(), FIFE::RenderBackend::createMainScreen(), FIFE::DeviceCaps::fillDeviceCaps(), FL_LOG, FL_WARN, FIFE::DeviceCaps::getAvailableDrivers(), FIFE::EngineSettings::getBitsPerPixel(), FIFE::EngineSettings::getColorKey(), FIFE::EngineSettings::getFrameLimit(), FIFE::EngineSettings::getInitialVolume(), FIFE::EngineSettings::getLightingModel(), FIFE::EngineSettings::getMouseSensitivity(), FIFE::DeviceCaps::getNearestScreenMode(), FIFE::EngineSettings::getRenderBackend(), FIFE::EngineSettings::getScreenHeight(), FIFE::EngineSettings::getScreenWidth(), FIFE::EngineSettings::getVideoDriver(), FIFE::EngineSettings::getWindowIcon(), FIFE::EngineSettings::getWindowTitle(), FIFE::RenderBackend::init(), FIFE::EngineSettings::isColorKeyEnabled(), FIFE::EngineSettings::isFrameLimitEnabled(), FIFE::EngineSettings::isFullScreen(), FIFE::EngineSettings::isGLCompressImages(), FIFE::EngineSettings::isGLUseFramebuffer(), FIFE::EngineSettings::isGLUseNPOT(), FIFE::EngineSettings::isMouseAccelerationEnabled(), m_cursor, m_destroyed, m_devcaps, m_eventmanager, m_imagemanager, m_model, m_offrenderer, m_renderbackend, m_renderers, m_screenMode, m_settings, m_soundclipmanager, m_soundmanager, m_targetrenderer, m_timemanager, m_vfs, FIFE::RenderBackend::setColorKeyEnabled(), FIFE::RenderBackend::setFramebufferEnabled(), FIFE::RenderBackend::setFrameLimit(), FIFE::RenderBackend::setFrameLimitEnabled(), FIFE::RenderBackend::setImageCompressingEnabled(), FIFE::RenderBackend::setLightingModel(), FIFE::EventManager::setMouseAccelerationEnabled(), FIFE::EventManager::setMouseSensitivity(), FIFE::RenderBackend::setNPOTEnabled(), and FIFE::SoundManager::setVolume().

void FIFE::Engine::initializePumping ( )

Initializes the continuous processing of the engine Call this only once in your program.

Definition at line 337 of file engine.cpp.

References m_eventmanager, and FIFE::EventManager::processEvents().

void FIFE::Engine::removeChangeListener ( IEngineChangeListener listener)

Removes associated change listener.

Parameters
listenerto remove

Definition at line 370 of file engine.cpp.

References m_changelisteners.

void FIFE::Engine::setGuiManager ( IGUIManager guimanager)
inline

Sets the GUI Manager to use.

Engine takes ownership of the manager so DONT DELETE IT!

Definition at line 145 of file engine.h.

References m_guimanager.

Member Data Documentation

std::vector<IEngineChangeListener*> FIFE::Engine::m_changelisteners
private

Definition at line 222 of file engine.h.

Referenced by addChangeListener(), changeScreenMode(), and removeChangeListener().

Cursor* FIFE::Engine::m_cursor
private

Definition at line 210 of file engine.h.

Referenced by changeScreenMode(), destroy(), getCursor(), init(), and pump().

bool FIFE::Engine::m_destroyed
private

Definition at line 211 of file engine.h.

Referenced by destroy(), init(), and ~Engine().

DeviceCaps FIFE::Engine::m_devcaps
private

Definition at line 214 of file engine.h.

Referenced by getDeviceCaps(), and init().

EventManager* FIFE::Engine::m_eventmanager
private

Definition at line 200 of file engine.h.

Referenced by getEventManager(), init(), initializePumping(), and pump().

IGUIManager* FIFE::Engine::m_guimanager
private

Definition at line 199 of file engine.h.

Referenced by changeScreenMode(), destroy(), getGuiManager(), pump(), and setGuiManager().

ImageManager* FIFE::Engine::m_imagemanager
private

Definition at line 203 of file engine.h.

Referenced by changeScreenMode(), destroy(), getImageManager(), and init().

LogManager* FIFE::Engine::m_logmanager
private

Definition at line 208 of file engine.h.

Referenced by Engine(), and getLogManager().

Model* FIFE::Engine::m_model
private

Definition at line 207 of file engine.h.

Referenced by destroy(), getModel(), init(), and pump().

OffRenderer* FIFE::Engine::m_offrenderer
private

Definition at line 218 of file engine.h.

Referenced by destroy(), getOffRenderer(), init(), and pump().

RenderBackend* FIFE::Engine::m_renderbackend
private

Definition at line 198 of file engine.h.

Referenced by changeScreenMode(), destroy(), getRenderBackend(), init(), and pump().

std::vector<RendererBase*> FIFE::Engine::m_renderers
private

Definition at line 220 of file engine.h.

Referenced by destroy(), and init().

ScreenMode FIFE::Engine::m_screenMode
private

Definition at line 216 of file engine.h.

Referenced by init().

EngineSettings FIFE::Engine::m_settings
private

Definition at line 213 of file engine.h.

Referenced by getSettings(), and init().

SoundClipManager* FIFE::Engine::m_soundclipmanager
private

Definition at line 204 of file engine.h.

Referenced by destroy(), getSoundClipManager(), and init().

SoundManager* FIFE::Engine::m_soundmanager
private

Definition at line 201 of file engine.h.

Referenced by destroy(), getSoundManager(), and init().

TargetRenderer* FIFE::Engine::m_targetrenderer
private

Definition at line 219 of file engine.h.

Referenced by destroy(), getTargetRenderer(), init(), and pump().

TimeManager* FIFE::Engine::m_timemanager
private

Definition at line 202 of file engine.h.

Referenced by destroy(), getTimeManager(), init(), and pump().

VFS* FIFE::Engine::m_vfs
private

Definition at line 206 of file engine.h.

Referenced by destroy(), getVFS(), and init().


The documentation for this class was generated from the following files: