![]() |
GDevelop Core
Core library for developing platforms and tools compatible with GDevelop.
|
Represent an behaviors container of a platform. More...
#include <BehaviorsContainer.h>
Public Member Functions | |
| BehaviorsContainer (bool isOverriding=false) | |
| BehaviorsContainer (const gd::BehaviorsContainer &behaviorsContainer) | |
| BehaviorsContainer & | operator= (const gd::BehaviorsContainer &behaviorsContainer) |
| virtual | ~BehaviorsContainer () |
Behaviors management | |
Members functions related to behaviors management. | |
| std::vector< gd::String > | GetAllBehaviorNames () const |
| Return a vector containing the names of all the behaviors used by the behaviors container. | |
| Behavior & | GetBehavior (const gd::String &name) |
| Return a reference to the content of the behavior called name. | |
| const Behavior & | GetBehavior (const gd::String &name) const |
| Return a reference to the content of the behavior called name. | |
| bool | HasBehaviorNamed (const gd::String &name) const |
| Return true if behaviors container has a behavior called name. | |
| void | RemoveBehavior (const gd::String &name) |
| Remove behavior called name. | |
| bool | RenameBehavior (const gd::String &name, const gd::String &newName) |
| Change the name of behavior called name to newName. More... | |
| gd::Behavior * | AddNewBehavior (const gd::Project &project, const gd::String &type, const gd::String &name) |
| Add the behavior of the specified type with the specified name. More... | |
| const std::map< gd::String, std::unique_ptr< gd::Behavior > > & | GetAllBehaviorContents () const |
| Get a read-only access to the map containing the behaviors with their properties. | |
Serialization | |
Members functions related to serialization of the behaviors container | |
| bool | isOverriding = false |
| std::map< gd::String, std::unique_ptr< gd::Behavior > > | behaviors |
| void | SerializeTo (SerializerElement &element) const |
| Serialize the behaviors container. More... | |
| void | UnserializeFrom (gd::Project &project, const SerializerElement &element) |
| Unserialize the behaviors container. More... | |
| void | Init (const gd::BehaviorsContainer &behaviorsContainer) |
Represent an behaviors container of a platform.
| gd::BehaviorsContainer::BehaviorsContainer | ( | bool | isOverriding = false | ) |
Create a new behaviors container with the name passed as argument.
|
inline |
Copy constructor. Calls Init().
|
virtual |
Destructor.
| gd::Behavior * gd::BehaviorsContainer::AddNewBehavior | ( | const gd::Project & | project, |
| const gd::String & | type, | ||
| const gd::String & | name | ||
| ) |
Add the behavior of the specified type with the specified name.
The project's current platform is used to initialize the content.
|
protected |
Initialize behaviors container using another behaviors container. Used by copy-ctor and assign-op. Don't forget to update me if members were changed!
It's needed because there is no default copy for a map of unique_ptr like behaviors and it must be a deep copy.
|
inline |
Assignment operator. Calls Init().
| bool gd::BehaviorsContainer::RenameBehavior | ( | const gd::String & | name, |
| const gd::String & | newName | ||
| ) |
Change the name of behavior called name to newName.
| void gd::BehaviorsContainer::SerializeTo | ( | SerializerElement & | element | ) | const |
Serialize the behaviors container.
| void gd::BehaviorsContainer::UnserializeFrom | ( | gd::Project & | project, |
| const SerializerElement & | element | ||
| ) |
Unserialize the behaviors container.
|
protected |
Contains all behaviors and their properties for the behaviors container. Behavior contents are the ownership of the behaviors container.