Drag[en]gine Game Engine  1.0
deEngine Class Reference

Drag[en]gine Game Engine Class. More...

#include <deEngine.h>

Public Member Functions

Constructors and Destructors
 deEngine (deOS *os)
 ~deEngine ()
 Retrieves the default pseudo rundom number generator. More...
System Accessors

Retrieves various System objects.

deModuleSystemGetModuleSystem () const
int GetSystemCount () const
deBaseSystemGetSystemAt (int index) const
deGraphicSystemGetGraphicSystem () const
deInputSystemGetInputSystem () const
dePhysicsSystemGetPhysicsSystem () const
deScriptingSystemGetScriptingSystem () const
deCrashRecoverySystemGetCrashRecoverySystem () const
deAnimatorSystemGetAnimatorSystem () const
deAudioSystemGetAudioSystem () const
deNetworkSystemGetNetworkSystem () const
deAISystemGetAISystem () const
deSynthesizerSystemGetSynthesizerSystem () const
void LoadModules ()
Crash Recovery System ( CRS )

Signals to the game engine unexpected errors in one of the engine systems. During the next update cycle the engine will enter CRS mode to handle the errors.

deErrorTraceGetErrorTrace () const
bool GetScriptFailed () const
void SignalScriptFailed ()
bool GetSystemFailed () const
void SignalSystemFailed ()
void ResetFailureFlags ()
deLoggerGetLogger () const
void SetLogger (deLogger *logger)
Resource Manager Accessors

Retrieves various resource managers. You can either retrieve them by index or by specifying the resource type you are looking for. Furthermore there are convenience functions to safely access a resource manager of the given type.

int GetResourceManagerCount () const
deResourceManagerGetResourceManagerAt (int index) const
deResourceManagerGetResourceManagerFor (int resourceType) const
deAIManagerGetAIManager () const
deAnimationManagerGetAnimationManager () const
deAnimatorManagerGetAnimatorManager () const
deAnimatorInstanceManagerGetAnimatorInstanceManager () const
deBillboardManagerGetBillboardManager () const
deCanvasManagerGetCanvasManager () const
deCameraManagerGetCameraManager () const
deCaptureCanvasManagerGetCaptureCanvasManager () const
deColliderManagerGetColliderManager () const
deComponentManagerGetComponentManager () const
deConnectionManagerGetConnectionManager () const
deDebugDrawerManagerGetDebugDrawerManager () const
deDecalManagerGetDecalManager () const
deDynamicSkinManagerGetDynamicSkinManager () const
deEffectManagerGetEffectManager () const
deEnvMapProbeManagerGetEnvMapProbeManager () const
deFontManagerGetFontManager () const
deForceFieldManagerGetForceFieldManager () const
deHeightTerrainManagerGetHeightTerrainManager () const
deImageManagerGetImageManager () const
deLanguagePackManagerGetLanguagePackManager () const
deLightManagerGetLightManager () const
deLocomotionManagerGetLocomotionManager () const
deLumimeterManagerGetLumimeterManager () const
deMicrophoneManagerGetMicrophoneManager () const
deModelManagerGetModelManager () const
deNavigationBlockerManagerGetNavigationBlockerManager () const
deNavigationSpaceManagerGetNavigationSpaceManager () const
deNavigatorManagerGetNavigatorManager () const
deNetworkStateManagerGetNetworkStateManager () const
deOcclusionMeshManagerGetOcclusionMeshManager () const
deParticleEmitterManagerGetParticleEmitterManager () const
deParticleEmitterInstanceManagerGetParticleEmitterInstanceManager () const
dePropFieldManagerGetPropFieldManager () const
deRenderWindowManagerGetRenderWindowManager () const
deRigManagerGetRigManager () const
deServerManagerGetServerManager () const
deSkinManagerGetSkinManager () const
deSkyManagerGetSkyManager () const
deSmokeEmitterManagerGetSmokeEmitterManager () const
deSoundManagerGetSoundManager () const
deSpeakerManagerGetSpeakerManager () const
deSynthesizerManagerGetSynthesizerManager () const
deSynthesizerInstanceManagerGetSynthesizerInstanceManager () const
deTouchSensorManagerGetTouchSensorManager () const
deVideoManagerGetVideoManager () const
deVideoPlayerManagerGetVideoPlayerManager () const
deWorldManagerGetWorldManager () const
deParallelProcessingGetParallelProcessing ()
 Parallel processing. More...
const deParallelProcessingGetParallelProcessing () const
deResourceLoaderGetResourceLoader () const
void RemoveLeakingResources ()
File System Management
const decStringGetDataDir () const
 Retrieves the game data directory. More...
void SetDataDir (const char *dataDir)
 Sets the game data directory. More...
const decStringGetCacheAppID () const
 Retrieves the unique catch directory identifier for the application. More...
void SetCacheAppID (const char *cacheAppID)
 Sets the unique catch directory identifier for the application. More...
deVirtualFileSystemGetVirtualFileSystem () const
 Virtual file system used by the game engine. More...
Frame Information
float GetElapsedTime () const
void SetElapsedTime (float elapsed)
int GetFPSRate () const
Operating System Bindings
deCmdLineArgsGetArguments () const
deOSGetOS () const
bool GetQuitRequest () const
void Quit ()
void ResetQuitRequest ()
Game Engine Run Time
bool Run (const char *scriptDirectory, const char *gameObject)
 Run game engine. More...
void ResetTimers ()
void UpdateElapsedTime ()
void RunSingleFrame ()

Detailed Description

Drag[en]gine Game Engine Class.

Manages the runtime of the entire game engine. Create one instance of this class for each game running. The class is safe to be used in multiple instances but this behaviour can be restricted by single type modules grabbing certain devices.

To launch successfully a game with this engine create first one instance of this class. Then set your game specific informations to the shared data directory of the engine and your game data directory. You are now ready to launch the game by calling the run function. You need to specify the script directory inside your data directory where the scripting module has to look for your game scripts. The run function catches exceptions itself hence there is no need to enclose it in a try-catch block.

If you plan to use the library in slave mode hence only for rendering and you provide the run loop then you can do parts of the run() function yourself. Be carefull though as wrong setting will result in crashes. Wrapping all in an try-catch clause should be enough for testing to be safe.

Pl├╝ss Roland

Constructor & Destructor Documentation

◆ deEngine()

deEngine::deEngine ( deOS os)

Creates a new instance of a game engine. Uses the given OS to operate the engine and modules.

◆ ~deEngine()

deEngine::~deEngine ( )

Member Function Documentation

◆ GetAIManager()

deAIManager* deEngine::GetAIManager ( ) const

Referenced by GetLogger().

◆ GetAISystem()

deAISystem* deEngine::GetAISystem ( ) const

Referenced by GetModuleSystem().

◆ GetAnimationManager()

deAnimationManager* deEngine::GetAnimationManager ( ) const

Referenced by GetLogger().

◆ GetAnimatorInstanceManager()

deAnimatorInstanceManager* deEngine::GetAnimatorInstanceManager ( ) const

Referenced by GetLogger().

◆ GetAnimatorManager()

deAnimatorManager* deEngine::GetAnimatorManager ( ) const

Referenced by GetLogger().

◆ GetAnimatorSystem()

deAnimatorSystem* deEngine::GetAnimatorSystem ( ) const

Referenced by GetModuleSystem().

◆ GetArguments()

deCmdLineArgs* deEngine::GetArguments ( ) const

Retrieves the command line arguments.

◆ GetAudioSystem()

deAudioSystem* deEngine::GetAudioSystem ( ) const

Referenced by GetModuleSystem().

◆ GetBillboardManager()

deBillboardManager* deEngine::GetBillboardManager ( ) const

Referenced by GetLogger().

◆ GetCacheAppID()

const decString& deEngine::GetCacheAppID ( ) const

Retrieves the unique catch directory identifier for the application.

If the path is empty no application specific cache will be provided.

References SetCacheAppID().

◆ GetCameraManager()

deCameraManager* deEngine::GetCameraManager ( ) const

Referenced by GetLogger().

◆ GetCanvasManager()

deCanvasManager* deEngine::GetCanvasManager ( ) const

Referenced by GetLogger().

◆ GetCaptureCanvasManager()

deCaptureCanvasManager* deEngine::GetCaptureCanvasManager ( ) const

Referenced by GetLogger().

◆ GetColliderManager()

deColliderManager* deEngine::GetColliderManager ( ) const

Referenced by GetLogger().

◆ GetComponentManager()

deComponentManager* deEngine::GetComponentManager ( ) const

Referenced by GetLogger().

◆ GetConnectionManager()

deConnectionManager* deEngine::GetConnectionManager ( ) const

Referenced by GetLogger().

◆ GetCrashRecoverySystem()

deCrashRecoverySystem* deEngine::GetCrashRecoverySystem ( ) const

Referenced by GetModuleSystem().

◆ GetDataDir()

const decString& deEngine::GetDataDir ( ) const

Retrieves the game data directory.

This directory is considered the virtual root directory of your gama data. All files handled with the file manager retrieved through GetFileManager are relative to this directory. The game engine uses this file manager to locate all resource files. Also the scripting system expects script files to be somewhere inside this directory.

References SetDataDir().

◆ GetDebugDrawerManager()

deDebugDrawerManager* deEngine::GetDebugDrawerManager ( ) const

Referenced by GetLogger().

◆ GetDecalManager()

deDecalManager* deEngine::GetDecalManager ( ) const

Referenced by GetLogger().

◆ GetDynamicSkinManager()

deDynamicSkinManager* deEngine::GetDynamicSkinManager ( ) const

Referenced by GetLogger().

◆ GetEffectManager()

deEffectManager* deEngine::GetEffectManager ( ) const

Referenced by GetLogger().

◆ GetElapsedTime()

float deEngine::GetElapsedTime ( ) const

Retrieves the time elapsed since the last frame update in seconds.

References GetFPSRate(), and SetElapsedTime().

◆ GetEnvMapProbeManager()

deEnvMapProbeManager* deEngine::GetEnvMapProbeManager ( ) const

Referenced by GetLogger().

◆ GetErrorTrace()

deErrorTrace* deEngine::GetErrorTrace ( ) const

Retrieves the error trace object.

◆ GetFontManager()

deFontManager* deEngine::GetFontManager ( ) const

Referenced by GetLogger().

◆ GetForceFieldManager()

deForceFieldManager* deEngine::GetForceFieldManager ( ) const

Referenced by GetLogger().

◆ GetFPSRate()

int deEngine::GetFPSRate ( ) const

Retrieves the frame-per-second rate averaged over the last couple of frames.

Referenced by GetElapsedTime().

◆ GetGraphicSystem()

deGraphicSystem* deEngine::GetGraphicSystem ( ) const

Referenced by GetModuleSystem().

◆ GetHeightTerrainManager()

deHeightTerrainManager* deEngine::GetHeightTerrainManager ( ) const

Referenced by GetLogger().

◆ GetImageManager()

deImageManager* deEngine::GetImageManager ( ) const

Referenced by GetLogger().

◆ GetInputSystem()

deInputSystem* deEngine::GetInputSystem ( ) const

Referenced by GetModuleSystem().

◆ GetLanguagePackManager()

deLanguagePackManager* deEngine::GetLanguagePackManager ( ) const

Referenced by GetLogger().

◆ GetLightManager()

deLightManager* deEngine::GetLightManager ( ) const

Referenced by GetLogger().

◆ GetLocomotionManager()

deLocomotionManager* deEngine::GetLocomotionManager ( ) const

Referenced by GetLogger().

◆ GetLogger()

◆ GetLumimeterManager()

deLumimeterManager* deEngine::GetLumimeterManager ( ) const

Referenced by GetLogger().

◆ GetMicrophoneManager()

deMicrophoneManager* deEngine::GetMicrophoneManager ( ) const

Referenced by GetLogger().

◆ GetModelManager()

deModelManager* deEngine::GetModelManager ( ) const

Referenced by GetLogger().

◆ GetModuleSystem()

◆ GetNavigationBlockerManager()

deNavigationBlockerManager* deEngine::GetNavigationBlockerManager ( ) const

Referenced by GetLogger().

◆ GetNavigationSpaceManager()

deNavigationSpaceManager* deEngine::GetNavigationSpaceManager ( ) const

Referenced by GetLogger().

◆ GetNavigatorManager()

deNavigatorManager* deEngine::GetNavigatorManager ( ) const

Referenced by GetLogger().

◆ GetNetworkStateManager()

deNetworkStateManager* deEngine::GetNetworkStateManager ( ) const

Referenced by GetLogger().

◆ GetNetworkSystem()

deNetworkSystem* deEngine::GetNetworkSystem ( ) const

Referenced by GetModuleSystem().

◆ GetOcclusionMeshManager()

deOcclusionMeshManager* deEngine::GetOcclusionMeshManager ( ) const

Referenced by GetLogger().

◆ GetOS()

deOS* deEngine::GetOS ( ) const

Retrieves the operating system object.

◆ GetParallelProcessing() [1/2]

deParallelProcessing& deEngine::GetParallelProcessing ( )

Parallel processing.

◆ GetParallelProcessing() [2/2]

const deParallelProcessing& deEngine::GetParallelProcessing ( ) const

◆ GetParticleEmitterInstanceManager()

deParticleEmitterInstanceManager* deEngine::GetParticleEmitterInstanceManager ( ) const

Referenced by GetLogger().

◆ GetParticleEmitterManager()

deParticleEmitterManager* deEngine::GetParticleEmitterManager ( ) const

Referenced by GetLogger().

◆ GetPhysicsSystem()

dePhysicsSystem* deEngine::GetPhysicsSystem ( ) const

Referenced by GetModuleSystem().

◆ GetPRNG()

decPRNG& deEngine::GetPRNG ( )

Retrieves the default pseudo rundom number generator.

◆ GetPropFieldManager()

dePropFieldManager* deEngine::GetPropFieldManager ( ) const

Referenced by GetLogger().

◆ GetQuitRequest()

bool deEngine::GetQuitRequest ( ) const

Determine if the engine received a quit request.

References Quit(), ResetQuitRequest(), ResetTimers(), Run(), RunSingleFrame(), and UpdateElapsedTime().

◆ GetRenderWindowManager()

deRenderWindowManager* deEngine::GetRenderWindowManager ( ) const

Referenced by GetLogger().

◆ GetResourceLoader()

deResourceLoader* deEngine::GetResourceLoader ( ) const

Retrieves the resource loader.

References RemoveLeakingResources().

◆ GetResourceManagerAt()

deResourceManager* deEngine::GetResourceManagerAt ( int  index) const

Referenced by GetLogger().

◆ GetResourceManagerCount()

int deEngine::GetResourceManagerCount ( ) const

Referenced by GetLogger().

◆ GetResourceManagerFor()

deResourceManager* deEngine::GetResourceManagerFor ( int  resourceType) const

Referenced by GetLogger().

◆ GetRigManager()

deRigManager* deEngine::GetRigManager ( ) const

Referenced by GetLogger().

◆ GetScriptFailed()

bool deEngine::GetScriptFailed ( ) const

Determines if the scripting system failed.

◆ GetScriptingSystem()

deScriptingSystem* deEngine::GetScriptingSystem ( ) const

Referenced by GetModuleSystem().

◆ GetServerManager()

deServerManager* deEngine::GetServerManager ( ) const

Referenced by GetLogger().

◆ GetSkinManager()

deSkinManager* deEngine::GetSkinManager ( ) const

Referenced by GetLogger().

◆ GetSkyManager()

deSkyManager* deEngine::GetSkyManager ( ) const

Referenced by GetLogger().

◆ GetSmokeEmitterManager()

deSmokeEmitterManager* deEngine::GetSmokeEmitterManager ( ) const

Referenced by GetLogger().

◆ GetSoundManager()

deSoundManager* deEngine::GetSoundManager ( ) const

Referenced by GetLogger().

◆ GetSpeakerManager()

deSpeakerManager* deEngine::GetSpeakerManager ( ) const

Referenced by GetLogger().

◆ GetSynthesizerInstanceManager()

deSynthesizerInstanceManager* deEngine::GetSynthesizerInstanceManager ( ) const

Referenced by GetLogger().

◆ GetSynthesizerManager()

deSynthesizerManager* deEngine::GetSynthesizerManager ( ) const

Referenced by GetLogger().

◆ GetSynthesizerSystem()

deSynthesizerSystem* deEngine::GetSynthesizerSystem ( ) const

Referenced by GetModuleSystem().

◆ GetSystemAt()

deBaseSystem* deEngine::GetSystemAt ( int  index) const

Referenced by GetModuleSystem().

◆ GetSystemCount()

int deEngine::GetSystemCount ( ) const

Referenced by GetModuleSystem().

◆ GetSystemFailed()

bool deEngine::GetSystemFailed ( ) const

Determines if some other system failed.

◆ GetTouchSensorManager()

deTouchSensorManager* deEngine::GetTouchSensorManager ( ) const

Referenced by GetLogger().

◆ GetVideoManager()

deVideoManager* deEngine::GetVideoManager ( ) const

Referenced by GetLogger().

◆ GetVideoPlayerManager()

deVideoPlayerManager* deEngine::GetVideoPlayerManager ( ) const

Referenced by GetLogger().

◆ GetVirtualFileSystem()

deVirtualFileSystem* deEngine::GetVirtualFileSystem ( ) const

Virtual file system used by the game engine.

◆ GetWorldManager()

deWorldManager* deEngine::GetWorldManager ( ) const

Referenced by GetLogger().

◆ LoadModules()

void deEngine::LoadModules ( )

Scans the module directory and loads all modules in there.

Referenced by GetModuleSystem().

◆ Quit()

void deEngine::Quit ( )

Requests the engine to quit before the next frame update cycle.

Referenced by GetQuitRequest().

◆ RemoveLeakingResources()

void deEngine::RemoveLeakingResources ( )

Remove all resources and report them. This function is used to check if a game left behind unreleased resources and to release the. This ensures a new game can use the same engine without potential left behind resources of the previous game to pollute the memory. Leaving behind resources after the game finished is a bug and thus this function lists all culprit resources as good as possible. The engine call this method before releasing all the resource managers.

Referenced by GetResourceLoader().

◆ ResetFailureFlags()

void deEngine::ResetFailureFlags ( )

Reset failure flags.

Referenced by SignalSystemFailed().

◆ ResetQuitRequest()

void deEngine::ResetQuitRequest ( )

Reset quit request.

Referenced by GetQuitRequest().

◆ ResetTimers()

void deEngine::ResetTimers ( )

Resets the elapsed time counter. This is usefull after lengthy time operations like loading a game. Without this call the reported amount of seconds elapsed since the last frame update can grow tremendously huge resulting in strange movements in the first frame after the player takes control.

Referenced by GetQuitRequest().

◆ Run()

bool deEngine::Run ( const char *  scriptDirectory,
const char *  gameObject 

Run game engine.

Calling this function the control is handed over to the game engine. The scripts in the specified directory ( relative to the data directory ) are parsed and executed. This function returns control to you after a quit-request has been issued or an unrecoverable error has occured. The return value indicates if the game engine exited under normal circumstances or due to a severe error. This function already handles exceptions so there is no need to enclose it in a try-catch block.

scriptDirDirectory relative to data directory containing the script files for your game.
gameObjectInitial game object to create. Script module specific value. Usually a class or function name to use to create the game object
true if the game engine exited under normal circumstances or false if an unrecoverable error occured

Referenced by GetQuitRequest().

◆ RunSingleFrame()

void deEngine::RunSingleFrame ( )

Runs a single frame update. Used by launchers taking control of the entire engine run-time instead of handing it off using the Run function. In particular this does (in this order):

  • Send input events to the active scripting module.
  • Update the engine resource loader.
  • Call OnFrameUpdate function on the active scripting module.
  • Process audio using the active audio module.
  • Process networking using the active network module.
  • Call BeginFrame on the active graphic module.
  • Call PaintScreen on the active scripting module.
  • Call EndFrame on the active graphic module.

On errors the processing exits the function immediately. Check if GetScriptFailed or GetSystemFailed returns true and enter error handling if this is the case. UpdateElapsedTime or SetElapsedTime has to be called before calling this function.

Referenced by GetQuitRequest().

◆ SetCacheAppID()

void deEngine::SetCacheAppID ( const char *  cacheAppID)

Sets the unique catch directory identifier for the application.

If the path is empty no application specific cache will be provided.

Referenced by GetCacheAppID().

◆ SetDataDir()

void deEngine::SetDataDir ( const char *  dataDir)

Sets the game data directory.

This directory is considered the virtual root directory of your gama data. All files handled with the file manager retrieved through GetFileManager are relative to this directory. The game engine uses this file manager to locate all resource files. Also the scripting system expects script files to be somewhere inside this directory.

Referenced by GetDataDir().

◆ SetElapsedTime()

void deEngine::SetElapsedTime ( float  elapsed)

Sets the time elapsed since the last frame update in seconds. Can be called instead of UpdateElapsedTime to explicitely set the elapsed time. Resets the elapsed time timer and updates the FPS Rate.

Referenced by GetElapsedTime().

◆ SetLogger()

void deEngine::SetLogger ( deLogger logger)

Sets the logger.

Referenced by GetLogger().

◆ SignalScriptFailed()

void deEngine::SignalScriptFailed ( )

Signals that the scripting system failed.

◆ SignalSystemFailed()

void deEngine::SignalSystemFailed ( )

Signals that some other system failed.

References ResetFailureFlags().

◆ UpdateElapsedTime()

void deEngine::UpdateElapsedTime ( )

Updates the elapsed time since the last frame update using the internal timer. Used by launchers taking control of the entire engine run-time instead of handing it off using the Run function. Use ResetTimers to avoid too long elapsed time after long operations or use SetElapsedTime to set the elapsed time explicitely. Using this function though is the better solution. Updates the FPS rate. After this function RunDoSingleFrame is typically called. Before this function is called ProcessInput has to be called on the active input module and the quit request checked first.

Referenced by GetQuitRequest().

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