FIFE  6e1afdbeda11afe9ac53e6023a4be96ef88f1dc6
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...
 
AnimationManagergetAnimationManager () 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
 
AnimationManagerm_animationmanager
 
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 80 of file engine.h.

Constructor & Destructor Documentation

FIFE::Engine::Engine ( )

Constructor.

Definition at line 91 of file engine.cpp.

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

FIFE::Engine::~Engine ( )
virtual

Destructor.

Definition at line 316 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 389 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 140 of file engine.cpp.

References FIFE::RenderBackend::createMainScreen(), FIFE::ScreenMode::getHeight(), FIFE::ScreenMode::getWidth(), FIFE::EngineSettings::getWindowIcon(), FIFE::EngineSettings::getWindowTitle(), FIFE::Cursor::invalidate(), FIFE::ImageManager::invalidateAll(), m_changelisteners, m_cursor, m_guimanager, m_imagemanager, m_renderbackend, m_settings, and FIFE::IGUIManager::resizeTopContainer().

void FIFE::Engine::destroy ( )

Explicit destruction of engine.

Definition at line 322 of file engine.cpp.

References FIFE::_log, FL_LOG, m_animationmanager, m_cursor, m_destroyed, m_eventmanager, 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 385 of file engine.cpp.

AnimationManager* FIFE::Engine::getAnimationManager ( ) const
inline

Provides access point to the ImageManager.

Definition at line 158 of file engine.h.

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

Returns cursor used in the engine.

Definition at line 182 of file engine.h.

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

Gets device capabilities.

Definition at line 136 of file engine.cpp.

References m_devcaps.

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

Provides access point to the EventManager.

Definition at line 136 of file engine.h.

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

Provides access point to the GUI Manager.

Definition at line 150 of file engine.h.

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

Provides access point to the ImageManager.

Definition at line 154 of file engine.h.

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

Provides access point to the LogManager.

Definition at line 174 of file engine.h.

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

Provides access point to the Model.

Definition at line 170 of file engine.h.

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

Provides access point to the OffRenderer.

Definition at line 186 of file engine.h.

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

Provides access point to the RenderBackend.

Definition at line 166 of file engine.h.

EngineSettings & FIFE::Engine::getSettings ( )

Gets settings class for engine.

Definition at line 132 of file engine.cpp.

References m_settings.

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

Provides access point to the SoundClipManager.

Definition at line 162 of file engine.h.

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

Provides access point to the SoundManager.

Definition at line 132 of file engine.h.

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

Provides access point to the TargetRenderer.

Definition at line 190 of file engine.h.

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

Provides access point to the TimeManager.

Definition at line 140 of file engine.h.

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

Provides access point to the VFS.

Definition at line 178 of file engine.h.

void FIFE::Engine::init ( )

Initializes the engine.

Definition at line 159 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::getAvailableRenderDrivers(), FIFE::DeviceCaps::getAvailableVideoDrivers(), FIFE::EngineSettings::getBitsPerPixel(), FIFE::EngineSettings::getColorKey(), FIFE::EngineSettings::getDisplay(), FIFE::EngineSettings::getFrameLimit(), FIFE::EngineSettings::getGLAlphaTestValue(), FIFE::EngineSettings::getGLTextureFiltering(), FIFE::EngineSettings::getInitialVolume(), FIFE::EngineSettings::getLightingModel(), FIFE::EngineSettings::getMouseSensitivity(), FIFE::DeviceCaps::getNearestScreenMode(), FIFE::EngineSettings::getRefreshRate(), FIFE::EngineSettings::getRenderBackend(), FIFE::EngineSettings::getScreenHeight(), FIFE::EngineSettings::getScreenWidth(), FIFE::EngineSettings::getSDLDriver(), 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::isGLUseDepthBuffer(), FIFE::EngineSettings::isGLUseFramebuffer(), FIFE::EngineSettings::isGLUseMipmapping(), FIFE::EngineSettings::isGLUseMonochrome(), FIFE::EngineSettings::isGLUseNPOT(), FIFE::EngineSettings::isJoystickSupport(), FIFE::EngineSettings::isMouseAccelerationEnabled(), FIFE::EngineSettings::isNativeImageCursorEnabled(), FIFE::EngineSettings::isVSync(), m_animationmanager, 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::setAlphaTestValue(), FIFE::RenderBackend::setColorKeyEnabled(), FIFE::RenderBackend::setDepthBufferEnabled(), FIFE::RenderBackend::setFramebufferEnabled(), FIFE::RenderBackend::setFrameLimit(), FIFE::RenderBackend::setFrameLimitEnabled(), FIFE::RenderBackend::setImageCompressingEnabled(), FIFE::EventManager::setJoystickSupport(), FIFE::RenderBackend::setLightingModel(), FIFE::RenderBackend::setMipmappingEnabled(), FIFE::RenderBackend::setMonochromeEnabled(), FIFE::EventManager::setMouseAccelerationEnabled(), FIFE::EventManager::setMouseSensitivity(), FIFE::Cursor::setNativeImageCursorEnabled(), FIFE::RenderBackend::setNPOTEnabled(), FIFE::DeviceCaps::setRenderDriverName(), FIFE::RenderBackend::setTextureFiltering(), FIFE::DeviceCaps::setVideoDriverName(), FIFE::SoundManager::setVolume(), and FIFE::RenderBackend::setVSyncEnabled().

void FIFE::Engine::initializePumping ( )

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

Definition at line 359 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 393 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 146 of file engine.h.

Member Data Documentation

AnimationManager* FIFE::Engine::m_animationmanager
private

Definition at line 209 of file engine.h.

Referenced by destroy(), and init().

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

Definition at line 228 of file engine.h.

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

Cursor* FIFE::Engine::m_cursor
private

Definition at line 216 of file engine.h.

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

bool FIFE::Engine::m_destroyed
private

Definition at line 217 of file engine.h.

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

DeviceCaps FIFE::Engine::m_devcaps
private

Definition at line 220 of file engine.h.

Referenced by getDeviceCaps(), and init().

EventManager* FIFE::Engine::m_eventmanager
private

Definition at line 205 of file engine.h.

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

IGUIManager* FIFE::Engine::m_guimanager
private

Definition at line 204 of file engine.h.

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

ImageManager* FIFE::Engine::m_imagemanager
private

Definition at line 208 of file engine.h.

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

LogManager* FIFE::Engine::m_logmanager
private

Definition at line 214 of file engine.h.

Referenced by Engine().

Model* FIFE::Engine::m_model
private

Definition at line 213 of file engine.h.

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

OffRenderer* FIFE::Engine::m_offrenderer
private

Definition at line 224 of file engine.h.

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

RenderBackend* FIFE::Engine::m_renderbackend
private

Definition at line 203 of file engine.h.

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

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

Definition at line 226 of file engine.h.

Referenced by destroy(), and init().

ScreenMode FIFE::Engine::m_screenMode
private

Definition at line 222 of file engine.h.

Referenced by init().

EngineSettings FIFE::Engine::m_settings
private

Definition at line 219 of file engine.h.

Referenced by changeScreenMode(), getSettings(), and init().

SoundClipManager* FIFE::Engine::m_soundclipmanager
private

Definition at line 210 of file engine.h.

Referenced by destroy(), and init().

SoundManager* FIFE::Engine::m_soundmanager
private

Definition at line 206 of file engine.h.

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

TargetRenderer* FIFE::Engine::m_targetrenderer
private

Definition at line 225 of file engine.h.

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

TimeManager* FIFE::Engine::m_timemanager
private

Definition at line 207 of file engine.h.

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

VFS* FIFE::Engine::m_vfs
private

Definition at line 212 of file engine.h.

Referenced by destroy(), and init().


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