Game Develop C++ Platform: RuntimeScene Class Reference

| Game Develop C++ Platform Platform for developing native games based on OpenGL and SFML with Game Develop

- Main Page
- Modules
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Groups Pages
Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | Static Protected Attributes | List of all members
RuntimeScene Class Reference
Game engine

Represents a scene being played. More...

`#include <RuntimeScene.h>`

Inheritance diagram for RuntimeScene:
[legend]
Collaboration diagram for RuntimeScene:
[legend]

## Public Member Functions

| RuntimeScene (sf::RenderWindow *renderWindow_, RuntimeGame *game_)
RuntimeScene & | operator= (const RuntimeScene &scene)
| RuntimeScene (const RuntimeScene &scene)
const RuntimeVariablesContainer & | GetVariables () const
| Provide access to the variables container.
RuntimeVariablesContainer & | GetVariables ()
| Provide access to the variables container.
boost::shared_ptr < gd::ImageManager > | GetImageManager () const
| Shortcut for game.GetImageManager() More...
RuntimeLayer & | GetRuntimeLayer (const std::string &name)
void | DisplayText (Text &text)
const boost::shared_ptr < AutomatismsRuntimeSharedData > & | GetAutomatismSharedDatas (const std::string &automatismName) const
bool | LoadFromScene (const gd::Layout &scene)
bool | LoadFromSceneAndCustomInstances (const gd::Layout &scene, const gd::InitialInstancesContainer &instances)
void | CreateObjectsFrom (const gd::InitialInstancesContainer &container, float xOffset=0, float yOffset=0, std::map< const gd::InitialInstance *, boost::shared_ptr< RuntimeObject > > *optionalMap=NULL)
void | ChangeRenderWindow (sf::RenderWindow *window)
bool | RenderWindowIsFullScreen ()
void | SetRenderWindowIsFullScreen (bool yes=true)
bool | RenderWindowHasFocus ()
void | GotoSceneWhenEventsAreFinished (int scene)
int | RenderAndStep ()
void | RenderWithoutStep ()
void | SetTimeScale (double timeScale_)
double | GetTimeScale () const
signed long long | GetElapsedTime () const
signed long long | GetTimeFromStart () const
bool | IsFirstLoop () const
void | NotifyPauseWasMade (signed long long pauseTime_)
void | ManageRenderTargetEvents ()
bool | OrderObjectsByZOrder (RuntimeObjList &objList)
const std::vector< sf::Event > & | GetRenderTargetEvents () const
Code execution engine
Functions members giving access to the code execution engine.
boost::shared_ptr < CodeExecutionEngine > | GetCodeExecutionEngine () const
void | SetCodeExecutionEngine (boost::shared_ptr< CodeExecutionEngine > codeExecutionEngine_)

## Public Attributes

sf::RenderWindow * | renderWindow
| Pointer to the render window used for display.
RuntimeGame * | game
| Pointer to the game the scene is linked to.
ObjInstancesHolder | objectsInstances
| Contains all of the objects on the scene.
std::vector< ManualTimer > | timers
| List of the timer currently used.
bool | running
| True if the scene is being played.

## Protected Member Functions

void | Render ()
void | ManageObjectsBeforeEvents ()
void | ManageObjectsAfterEvents ()
bool | UpdateTime ()
bool | DisplayLegacyTexts (std::string layer="")
void | Init (const RuntimeScene &scene)

## Protected Attributes

bool | firstLoop
| true if the scene was just rendered once.
bool | isFullScreen
| As sf::RenderWindow can't say if it is fullscreen or not.
std::vector< sf::Event > | renderTargetEvents
signed int | realElapsedTime
| Elapsed time since last frame, in microseconds, without taking time scale in account.
signed int | elapsedTime
| Elapsed time since last frame, in microseconds ( elapsedTime = realElapsedTime*timeScale ).
double | timeScale
| Time scale.
signed long long | timeFromStart
| Time in microseconds elapsed from start.
signed long long | pauseTime
| Time to be subtracted to realElapsedTime for the current frame.
int | specialAction
| -1 for doing nothing, -2 to quit the game, another number to change the scene
RuntimeVariablesContainer | variables
| List of the scene variables.
std::vector< ExtensionBase * > | extensionsToBeNotifiedOnObjectDeletion
| List, built during LoadFromScene, containing a list of extensions which must be notified when an object is deleted.
sf::Clock | clock
bool | windowHasFocus
| True if the render target used by the scene has the focus.
std::map< std::string, boost::shared_ptr < AutomatismsRuntimeSharedData > > | automatismsSharedDatas
| Contains all automatisms shared datas.
std::vector< RuntimeLayer > | layers
| The layers used at runtime to display the scene.
boost::shared_ptr < CodeExecutionEngine > | codeExecutionEngine
CppPlatform * | platform
std::vector< Text > | textes
| Deprecated way of displaying a text.

## Static Protected Attributes

static RuntimeLayer | badRuntimeLayer
| Null object return by GetLayer when no appropriate layer could be found.

## Detailed Description

Represents a scene being played.

A RuntimeScene is used when a game is played.
It contains everything a scene provide, but also specific functions and members for runtime ( Render functions, objects instances, variables... )

## Member Function Documentation

void RuntimeScene::ChangeRenderWindow | ( | sf::RenderWindow * | window) |  |

Change the window used for rendering the scene

void RuntimeScene::CreateObjectsFrom | ( | const gd::InitialInstancesContainer & | container,
|  | float | xOffset = `0`,
|  | float | yOffset = `0`,
|  | std::map< const gd::InitialInstance *, boost::shared_ptr< RuntimeObject > > * | optionalMap = `NULL`
| ) |  |

Create the objects from an gd::InitialInstancesContainer object.

Parameters

  container | The object containing the initial instances to be created
  xOffset | The offset on x axis to be applied to objects created
  yOffset | The offset on y axis to be applied to objects created
  optionalMap | An optional pointer to a std::map<const gd::InitialInstance *, boost::shared_ptr<RuntimeObject> > which will be filled with the index of the initial instances. Can be NULL.

void RuntimeScene::DisplayText | ( | Text & | text) |  |

Add a text to be displayed on the scene

Deprecated:

const boost::shared_ptr<AutomatismsRuntimeSharedData>& RuntimeScene::GetAutomatismSharedDatas | ( | const std::string & | automatismName) |  | const

inline

Get the AutomatismsRuntimeSharedData associated with automatism. Be careful, no check is made to ensure that the shared data exist.

boost::shared_ptr<CodeExecutionEngine> RuntimeScene::GetCodeExecutionEngine | ( | ) |  | const

inline

Give access to the execution engine of the scene. Each scene has its own unique execution engine.

signed long long RuntimeScene::GetElapsedTime | ( | ) |  | const

inline

Get elapsed time since last frame, in microseconds.

boost::shared_ptr< gd::ImageManager > RuntimeScene::GetImageManager | ( | ) |  | const

Shortcut for game.GetImageManager()

Returns
  The image manager of the game.

const std::vector<sf::Event>& RuntimeScene::GetRenderTargetEvents | ( | ) |  | const

inline

Get a read-only list of SFML events managed by the render target.

RuntimeLayer & RuntimeScene::GetRuntimeLayer | ( | const std::string & | name) |  |

Get the layer with specified name.

signed long long RuntimeScene::GetTimeFromStart | ( | ) |  | const

inline

Get time elapsed since beginning, in microseconds.

double RuntimeScene::GetTimeScale | ( | ) |  | const

inline

Return scene time scale.

void RuntimeScene::GotoSceneWhenEventsAreFinished | ( | int | scene) |  |

After calling this method, RenderAndStep() will return the number passed as parameter.

See Also
  RenderAndStep

bool RuntimeScene::IsFirstLoop | ( | ) |  | const

inline

Return true if the scene was just rendered once.

bool RuntimeScene::LoadFromScene | ( | const gd::Layout & | scene) |  |

Set up the RuntimeScene using a Scene. Typically called automatically by the IDE or by the game executable.

Note
  Similar to calling LoadFromSceneAndCustomInstances(scene, scene.GetInitialInstances());

See Also
  LoadFromSceneAndCustomInstances

Here is the call graph for this function:

bool RuntimeScene::LoadFromSceneAndCustomInstances | ( | const gd::Layout & | scene,
|  | const gd::InitialInstancesContainer & | instances
| ) |  |

Set up the Runtime Scene using the instances and the scene.

Parameters

  scene | Scene used as context.
  instances | Initial instances to be put on the scene

Here is the call graph for this function:

void RuntimeScene::ManageObjectsAfterEvents | ( | ) |  |

protected

Delete objects, updates time and launch automatisms

Here is the call graph for this function:

void RuntimeScene::ManageObjectsBeforeEvents | ( | ) |  |

protected

Manage objects before launching events

Here is the call graph for this function:

void RuntimeScene::NotifyPauseWasMade | ( | signed long long | pauseTime_) |  |

inline

Notify the scene that something ( Like an open file dialog ) stopped scene rendering for a certain amount of time.

Parameters

  pauseTime_ | Pause duration, in microseconds.

bool RuntimeScene::OrderObjectsByZOrder | ( | RuntimeObjList & | objList) |  |

Order an object list according to object's Z coordinate.

void RuntimeScene::Render | ( | ) |  |

protected

Render a frame in the window

Here is the call graph for this function:

int RuntimeScene::RenderAndStep | ( | ) |  |

Render and play the scene one frame.

Returns
  -1 for doing nothing, -2 to quit the game, another number to change the scene

Here is the call graph for this function:

bool RuntimeScene::RenderWindowHasFocus | ( | ) |  |

inline

Return true if window has focus.

bool RuntimeScene::RenderWindowIsFullScreen | ( | ) |  |

inline

Return true if scene is rendered full screen.

void RuntimeScene::RenderWithoutStep | ( | ) |  |

Just render a frame.

Here is the call graph for this function:

void RuntimeScene::SetCodeExecutionEngine | ( | boost::shared_ptr< CodeExecutionEngine > | codeExecutionEngine_) |  |

inline

Give access to the execution engine of the scene. Each scene has its own unique execution engine.

void RuntimeScene::SetRenderWindowIsFullScreen | ( | bool | yes = `true`) |  |

inline

Change full screen state. The render window is itself not changed so as to be displayed fullscreen or not.

void RuntimeScene::SetTimeScale | ( | double | timeScale_) |  |

inline

Change scene time scale.

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

- RuntimeScene.h
- RuntimeScene.cpp