GDevelop Core
Core library for developing platforms and tools compatible with GDevelop.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
Public Member Functions | List of all members

Represent a layout ( also called a scene ) of a project. More...

#include <Layout.h>

Inherits gd::ObjectsContainer.

Public Member Functions

 Layout (const Layout &)
 
Layoutoperator= (const Layout &rhs)
 
LayoutClone () const
 Return a pointer to a copy of the layout.
 
void UpdateBehaviorsSharedData (gd::Project &project)
 
std::vector< gd::StringGetAllBehaviorSharedDataNames () const
 Get the names of all shared data stored for behaviors.
 
bool HasBehaviorSharedData (const gd::String &behaviorName)
 Check if shared data are stored for a behavior.
 
const gd::BehaviorContentGetBehaviorSharedData (const gd::String &behaviorName) const
 Get the shared data stored for a behavior.
 
gd::BehaviorContentGetBehaviorSharedData (const gd::String &behaviorName)
 Get the shared data stored for a behavior.
 
const std::map< gd::String,
std::unique_ptr
< gd::BehaviorContent > > & 
GetAllBehaviorSharedData () const
 Get a map of all shared data stored for behaviors.
 
const
gd::LayoutEditorCanvasOptions
GetAssociatedSettings () const
 
gd::LayoutEditorCanvasOptionsGetAssociatedSettings ()
 
BaseProfiler * GetProfiler () const
 
void SetProfiler (BaseProfiler *profiler_)
 
Common properties

Members functions related to common properties of layouts

void SetName (const gd::String &name_)
 
const gd::StringGetName () const
 
const gd::StringGetMangledName () const
 
void SetBackgroundColor (unsigned int r, unsigned int g, unsigned int b)
 
unsigned int GetBackgroundColorRed () const
 
unsigned int GetBackgroundColorGreen () const
 
unsigned int GetBackgroundColorBlue () const
 
const gd::StringGetWindowDefaultTitle () const
 
void SetWindowDefaultTitle (const gd::String &title_)
 
Layout's initial instances

Members functions related to initial instances of objects created at the layout start up

const
gd::InitialInstancesContainer
GetInitialInstances () const
 
gd::InitialInstancesContainerGetInitialInstances ()
 
Layout's events

Members functions related to events management.

const gd::EventsListGetEvents () const
 
gd::EventsListGetEvents ()
 
Variable management

Members functions related to layout variables management.

const gd::VariablesContainerGetVariables () const
 
gd::VariablesContainerGetVariables ()
 
Layout layers management

Members functions related to layout layers management. TODO: This could be moved to a separate class

bool HasLayerNamed (const gd::String &name) const
 Return true if the layer called "name" exists.
 
LayerGetLayer (const gd::String &name)
 Return a reference to the layer called "name".
 
const LayerGetLayer (const gd::String &name) const
 Return a reference to the layer called "name".
 
LayerGetLayer (std::size_t index)
 Return a reference to the layer at position "index" in the layers list.
 
const LayerGetLayer (std::size_t index) const
 Return a reference to the layer at position "index" in the layers list.
 
std::size_t GetLayerPosition (const gd::String &name) const
 Return the position of the layer called "name" in the layers list.
 
std::size_t GetLayersCount () const
 
void InsertNewLayer (const gd::String &name, std::size_t position)
 
void InsertLayer (const Layer &theLayer, std::size_t position)
 
void RemoveLayer (const gd::String &name)
 
void SwapLayers (std::size_t firstLayerIndex, std::size_t secondLayerIndex)
 
void MoveLayer (std::size_t oldIndex, std::size_t newIndex)
 
void SerializeLayersTo (SerializerElement &element) const
 Serialize the layers.
 
void UnserializeLayersFrom (const SerializerElement &element)
 Unserialize the layers.
 
Other properties
void DisableInputWhenFocusIsLost (bool disable=true)
 
bool IsInputDisabledWhenFocusIsLost ()
 
void SetStandardSortMethod (bool enable=true)
 
bool StandardSortMethod () const
 
void SetStopSoundsOnStartup (bool enable=true)
 
bool StopSoundsOnStartup () const
 
void SetOpenGLFOV (float oglFOV_)
 
float GetOpenGLFOV () const
 
void SetOpenGLZNear (float oglZNear_)
 
float GetOpenGLZNear () const
 
void SetOpenGLZFar (float oglZFar_)
 
float GetOpenGLZFar () const
 
Saving and loading

Members functions related to saving and loading the object.

void SerializeTo (SerializerElement &element) const
 Serialize the layout.
 
void UnserializeFrom (gd::Project &project, const SerializerElement &element)
 Unserialize the layout.
 
- Public Member Functions inherited from gd::ObjectsContainer
 ObjectsContainer ()
 Default constructor creating a container without any objects.
 
bool HasObjectNamed (const gd::String &name) const
 Return true if object called name exists.
 
ObjectGetObject (const gd::String &name)
 Return a reference to the object called name.
 
const gd::ObjectGetObject (const gd::String &name) const
 Return a reference to the object called name.
 
ObjectGetObject (std::size_t index)
 Return a reference to the object at position index in the objects list.
 
const gd::ObjectGetObject (std::size_t index) const
 Return a reference to the object at position index in the objects list.
 
std::size_t GetObjectPosition (const gd::String &name) const
 Return the position of the object called name in the objects list. More...
 
std::size_t GetObjectsCount () const
 Return the number of object.
 
gd::ObjectInsertNewObject (gd::Project &project, const gd::String &objectType, const gd::String &name, std::size_t position)
 Add a new empty object of type objectType called name at the specified position in the list.
More...
 
gd::ObjectInsertObject (const gd::Object &object, std::size_t position)
 Add a new object to the list. More...
 
void RemoveObject (const gd::String &name)
 Delete an object. More...
 
void MoveObject (std::size_t oldIndex, std::size_t newIndex)
 
void SwapObjects (std::size_t firstObjectIndex, std::size_t secondObjectIndex)
 Swap the position of the specified objects.
 
void MoveObjectToAnotherContainer (const gd::String &name, gd::ObjectsContainer &newContainer, std::size_t newPosition)
 
std::vector< std::unique_ptr
< gd::Object > > & 
GetObjects ()
 
const std::vector
< std::unique_ptr< gd::Object > > & 
GetObjects () const
 
void SerializeObjectsTo (SerializerElement &element) const
 Serialize instances container.
 
void UnserializeObjectsFrom (gd::Project &project, const SerializerElement &element)
 Unserialize the instances container.
 
ObjectGroupsContainerGetObjectGroups ()
 Return a reference to the project's objects groups.
 
const ObjectGroupsContainerGetObjectGroups () const
 Return a const reference to the project's objects groups.
 

Additional Inherited Members

- Protected Attributes inherited from gd::ObjectsContainer
std::vector< std::unique_ptr
< gd::Object > > 
initialObjects
 Objects contained.
 
gd::ObjectGroupsContainer objectGroups
 

Detailed Description

Represent a layout ( also called a scene ) of a project.

Member Function Documentation

void gd::Layout::DisableInputWhenFocusIsLost ( bool  disable = true)
inline

Set if the input must be disabled when window lose focus.

const gd::LayoutEditorCanvasOptions& gd::Layout::GetAssociatedSettings ( ) const
inline

Return the settings associated to the layout.

See also
gd::LayoutEditorCanvasOptions
gd::LayoutEditorCanvasOptions& gd::Layout::GetAssociatedSettings ( )
inline

Return the settings associated to the layout.

See also
gd::LayoutEditorCanvasOptions
unsigned int gd::Layout::GetBackgroundColorBlue ( ) const
inline

Get the background color blue component

unsigned int gd::Layout::GetBackgroundColorGreen ( ) const
inline

Get the background color green component

unsigned int gd::Layout::GetBackgroundColorRed ( ) const
inline

Get the background color red component

const gd::EventsList& gd::Layout::GetEvents ( ) const
inline

Get the events of the layout

gd::EventsList& gd::Layout::GetEvents ( )
inline

Get the events of the layout

const gd::InitialInstancesContainer& gd::Layout::GetInitialInstances ( ) const
inline

Return the container storing initial instances.

gd::InitialInstancesContainer& gd::Layout::GetInitialInstances ( )
inline

Return the container storing initial instances.

std::size_t gd::Layout::GetLayersCount ( ) const

Must return the number of layers.

const gd::String& gd::Layout::GetMangledName ( ) const
inline

Return the name of the layout mangled by SceneNameMangler.

const gd::String& gd::Layout::GetName ( ) const
inline

Return the name of the layout.

float gd::Layout::GetOpenGLFOV ( ) const
inline

Get OpenGL default field of view

float gd::Layout::GetOpenGLZFar ( ) const
inline

Get OpenGL far clipping plan

float gd::Layout::GetOpenGLZNear ( ) const
inline

Get OpenGL near clipping plan

BaseProfiler* gd::Layout::GetProfiler ( ) const
inline

Get the profiler associated with the scene. Can be NULL.

const gd::VariablesContainer& gd::Layout::GetVariables ( ) const
inline

Provide access to the gd::VariablesContainer member containing the layout variables

See also
gd::VariablesContainer
gd::VariablesContainer& gd::Layout::GetVariables ( )
inline

Provide access to the gd::VariablesContainer member containing the layout variables

See also
gd::VariablesContainer
const gd::String& gd::Layout::GetWindowDefaultTitle ( ) const
inline

Get scene window default title

void gd::Layout::InsertLayer ( const Layer theLayer,
std::size_t  position 
)

Must add a new the layer constructed from the layout passed as parameter.

Note
No pointer or reference must be kept on the layer passed as parameter.
Parameters
theLayerThe the layer that must be copied and inserted into the project
positionInsertion position. Even if the position is invalid, the layer must be inserted at the end of the layers list.
void gd::Layout::InsertNewLayer ( const gd::String name,
std::size_t  position 
)

Must add a new empty the layer sheet called "name" at the specified position in the layout list.

bool gd::Layout::IsInputDisabledWhenFocusIsLost ( )
inline

Return true if the input must be disabled when window lost focus.

void gd::Layout::MoveLayer ( std::size_t  oldIndex,
std::size_t  newIndex 
)

Change the position of the specified layer.

void gd::Layout::RemoveLayer ( const gd::String name)

Must delete the layer named "name".

void gd::Layout::SetBackgroundColor ( unsigned int  r,
unsigned int  g,
unsigned int  b 
)
inline

Set the background color

void gd::Layout::SetName ( const gd::String name_)

Change the name of the layout with the name passed as parameter.

void gd::Layout::SetOpenGLFOV ( float  oglFOV_)
inline

Set OpenGL default field of view

void gd::Layout::SetOpenGLZFar ( float  oglZFar_)
inline

Set OpenGL far clipping plan

void gd::Layout::SetOpenGLZNear ( float  oglZNear_)
inline

Set OpenGL near clipping plan

void gd::Layout::SetProfiler ( BaseProfiler *  profiler_)
inline

Set the profiler associated with the scene. Can be NULL.

void gd::Layout::SetStandardSortMethod ( bool  enable = true)
inline

Set if the objects z-order are sorted using the standard method

void gd::Layout::SetStopSoundsOnStartup ( bool  enable = true)
inline

Set if the scene must stop all the sounds being played when it is launched.

void gd::Layout::SetWindowDefaultTitle ( const gd::String title_)
inline

Set scene window default title

bool gd::Layout::StandardSortMethod ( ) const
inline

Return true if the objects z-order are sorted using the standard method

bool gd::Layout::StopSoundsOnStartup ( ) const
inline

Return true if the scene must stop all the sounds being played when it is launched

void gd::Layout::SwapLayers ( std::size_t  firstLayerIndex,
std::size_t  secondLayerIndex 
)

Swap the position of the specified layers.

void gd::Layout::UpdateBehaviorsSharedData ( gd::Project project)

This ensures that the scene had an instance of shared data for every behavior of every object that can be used on the scene (i.e. the objects of the scene and the global objects)

Must be called when a behavior have been added/deleted or when a scene have been added to a project.


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