![]() |
GDevelop C++ Platform
Platform for developing native games based on OpenGL and SFML with GDevelop
|
Represents a scene being played. More...
#include <RuntimeScene.h>
Inherits Scene.
Classes | |
struct | SceneChange |
Public Member Functions | |
RuntimeScene (sf::RenderWindow *renderWindow_, RuntimeGame *game_) | |
const RuntimeVariablesContainer & | GetVariables () const |
Provide access to the variables container. | |
RuntimeVariablesContainer & | GetVariables () |
Provide access to the variables container. | |
std::shared_ptr< gd::ImageManager > | GetImageManager () const |
Shortcut for game->GetImageManager() More... | |
const InputManager & | GetInputManager () const |
Get the input manager used to handle mouse, keyboard and touches events. | |
InputManager & | GetInputManager () |
Get the input manager used to handle mouse, keyboard and touches events. | |
const TimeManager & | GetTimeManager () const |
Get the time manager used to handle all time related values and timers. | |
TimeManager & | GetTimeManager () |
Get the time manager used to handle all time related values and timers. | |
RuntimeLayer & | GetRuntimeLayer (const gd::String &name) |
const RuntimeLayer & | GetRuntimeLayer (const gd::String &name) const |
const std::shared_ptr< BehaviorsRuntimeSharedData > & | GetBehaviorSharedData (const gd::String &behaviorName) const |
Return the shared data for a behavior. More... | |
bool | LoadFromScene (const gd::Layout &scene) |
Set up the RuntimeScene using a gd::Layout. More... | |
bool | LoadFromSceneAndCustomInstances (const gd::Layout &scene, const gd::InitialInstancesContainer &instances) |
Set up the RuntimeScene using the specified instances and scene. More... | |
void | CreateObjectsFrom (const gd::InitialInstancesContainer &container, float xOffset=0, float yOffset=0) |
void | ChangeRenderWindow (sf::RenderWindow *window) |
Change the window used for rendering the scene. | |
bool | RenderWindowIsFullScreen () |
Check if scene is rendered full screen. | |
void | SetRenderWindowIsFullScreen (bool yes=true) |
Change full screen state. The render window is itself not changed so as to be displayed fullscreen or not. | |
bool | RenderAndStep () |
void | RenderWithoutStep () |
Just render a frame, without applying logic or events on objects. | |
SceneChange | GetRequestedChange () |
void | RequestChange (SceneChange::Change change, gd::String sceneName="") |
Code execution engine | |
Functions members giving access to the code execution engine. | |
std::shared_ptr< CodeExecutionEngine > | GetCodeExecutionEngine () const |
Give access to the execution engine of the scene. Each scene has its own unique execution engine. | |
void | SetCodeExecutionEngine (std::shared_ptr< CodeExecutionEngine > codeExecutionEngine_) |
Give access to the execution engine of the scene. Each scene has its own unique execution engine. | |
Public Attributes | |
sf::RenderWindow * | renderWindow |
Pointer to the render window used for display. | |
RuntimeGame * | game |
Pointer to the game the scene is linked to. | |
BaseDebugger * | debugger |
Pointer to the debugger. Can be NULL. | |
ObjInstancesHolder | objectsInstances |
Contains all of the objects on the scene. | |
Protected Member Functions | |
void | ManageRenderTargetEvents () |
Handle the events made on the scene's window. | |
bool | OrderObjectsByZOrder (RuntimeObjNonOwningPtrList &objList) |
Order an object list according to object's Z coordinate. | |
void | Render () |
Render a frame in the window. | |
void | ManageObjectsBeforeEvents () |
To be called once during a step, to launch behaviors pre-events steps. | |
void | ManageObjectsAfterEvents () |
To be called once during a step, to remove objects marked as deleted in events, and to update objects position, forces and behaviors. | |
void | SetupOpenGLProjection () |
Set the OpenGL projection according to the window size and OpenGL scene options. | |
Protected Attributes | |
bool | isFullScreen |
InputManager | inputManager |
TimeManager | timeManager |
RuntimeVariablesContainer | variables |
List of the scene variables. | |
std::vector< ExtensionBase * > | extensionsToBeNotifiedOnObjectDeletion |
BehaviorsRuntimeSharedDataHolder | behaviorsSharedDatas |
Contains all behaviors shared datas. | |
std::vector< RuntimeLayer > | layers |
The layers used at runtime to display the scene. | |
std::shared_ptr< CodeExecutionEngine > | codeExecutionEngine |
SceneChange | requestedChange |
What should be done at the end of the frame. | |
sf::Clock | clock |
The clock used to track time. | |
Static Protected Attributes | |
static RuntimeLayer | badRuntimeLayer |
Represents a scene being played.
Contains game object instances and all runtime objects needed to play to a scene rendered in a SFML RenderWindow.
void RuntimeScene::CreateObjectsFrom | ( | const gd::InitialInstancesContainer & | container, |
float | xOffset = 0 , |
||
float | yOffset = 0 |
||
) |
Create the objects from an gd::InitialInstancesContainer object.
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 |
|
inline |
Return the shared data for a behavior.
name | The name of the behavior for which shared data must be fetched. |
std::shared_ptr< gd::ImageManager > RuntimeScene::GetImageManager | ( | ) | const |
Shortcut for game->GetImageManager()
RuntimeLayer & RuntimeScene::GetRuntimeLayer | ( | const gd::String & | name | ) |
Get the layer with specified name.
const RuntimeLayer & RuntimeScene::GetRuntimeLayer | ( | const gd::String & | name | ) | const |
Get the layer with specified name.
bool RuntimeScene::LoadFromScene | ( | const gd::Layout & | scene | ) |
Set up the RuntimeScene using a gd::Layout.
Typically called automatically by the IDE or by the game executable.
bool RuntimeScene::LoadFromSceneAndCustomInstances | ( | const gd::Layout & | scene, |
const gd::InitialInstancesContainer & | instances | ||
) |
Set up the RuntimeScene using the specified instances and scene.
scene | gd::Layout that should be loaded |
instances | Initial instances to be put on the scene |
bool RuntimeScene::RenderAndStep | ( | ) |
Render and play one frame.
|
staticprotected |
Null object return by GetLayer when no appropriate layer could be found.
|
protected |
List, built during LoadFromScene, containing a list of extensions which must be notified when an object is deleted.
|
protected |
As sf::RenderWindow can't say if it is fullscreen or not