GDevelop Core
Core library for developing platforms and tools compatible with GDevelop.
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::BehaviorsSharedDataGetBehaviorSharedData (const gd::String &behaviorName) const
 Get the shared data stored for a behavior.
 
gd::BehaviorsSharedDataGetBehaviorSharedData (const gd::String &behaviorName)
 Get the shared data stored for a behavior.
 
const std::map< gd::String, std::unique_ptr< gd::BehaviorsSharedData > > & GetAllBehaviorSharedData () const
 Get a map of all shared data stored for behaviors.
 
const gd::EditorSettingsGetAssociatedEditorSettings () const
 
gd::EditorSettingsGetAssociatedEditorSettings ()
 
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::InitialInstancesContainerGetInitialInstances () 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
 
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.
 
std::vector< const ObjectFolderOrObject * > GetAllObjectFolderOrObjects () const
 
gd::ObjectFolderOrObjectGetRootFolder ()
 
void AddMissingObjectsInRootFolder ()
 
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 (const 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::ObjectInsertNewObjectInFolder (const gd::Project &project, const gd::String &objectType, const gd::String &name, gd::ObjectFolderOrObject &objectFolderOrObject, std::size_t position)
 Add a new empty object of type objectType called name in the given folder at the specified position.
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 MoveObjectFolderOrObjectToAnotherContainerInFolder (gd::ObjectFolderOrObject &objectFolderOrObject, gd::ObjectsContainer &newContainer, gd::ObjectFolderOrObject &newParentFolder, 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 the objects container.
 
void UnserializeObjectsFrom (gd::Project &project, const SerializerElement &element)
 Unserialize the objects container.
 
void SerializeFoldersTo (SerializerElement &element) const
 Serialize folder structure.
 
void UnserializeFoldersFrom (gd::Project &project, const SerializerElement &element)
 Unserialize folder structure.
 
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

◆ DisableInputWhenFocusIsLost()

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

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

◆ GetAssociatedEditorSettings() [1/2]

gd::EditorSettings& gd::Layout::GetAssociatedEditorSettings ( )
inline

Return the settings associated to the layout.

See also
gd::EditorSettings

◆ GetAssociatedEditorSettings() [2/2]

const gd::EditorSettings& gd::Layout::GetAssociatedEditorSettings ( ) const
inline

Return the settings associated to the layout.

See also
gd::EditorSettings

◆ GetBackgroundColorBlue()

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

Get the background color blue component

◆ GetBackgroundColorGreen()

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

Get the background color green component

◆ GetBackgroundColorRed()

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

Get the background color red component

◆ GetEvents() [1/2]

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

Get the events of the layout

◆ GetEvents() [2/2]

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

Get the events of the layout

◆ GetInitialInstances() [1/2]

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

Return the container storing initial instances.

◆ GetInitialInstances() [2/2]

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

Return the container storing initial instances.

◆ GetLayersCount()

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

Must return the number of layers.

◆ GetMangledName()

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

Return the name of the layout mangled by SceneNameMangler.

◆ GetName()

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

Return the name of the layout.

◆ GetProfiler()

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

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

◆ GetVariables() [1/2]

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

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

See also
gd::VariablesContainer

◆ GetVariables() [2/2]

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

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

See also
gd::VariablesContainer

◆ GetWindowDefaultTitle()

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

Get scene window default title

◆ InsertLayer()

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 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.

◆ InsertNewLayer()

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.

◆ IsInputDisabledWhenFocusIsLost()

bool gd::Layout::IsInputDisabledWhenFocusIsLost ( )
inline

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

◆ MoveLayer()

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

Change the position of the specified layer.

◆ RemoveLayer()

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

Must delete the layer named "name".

◆ SetBackgroundColor()

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

Set the background color

◆ SetName()

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

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

◆ SetProfiler()

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

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

◆ SetStandardSortMethod()

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

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

◆ SetStopSoundsOnStartup()

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

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

◆ SetWindowDefaultTitle()

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

Set scene window default title

◆ StandardSortMethod()

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

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

◆ StopSoundsOnStartup()

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

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

◆ SwapLayers()

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

Swap the position of the specified layers.

◆ UpdateBehaviorsSharedData()

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: