GDevelop Core
Core library for developing platforms and tools compatible with GDevelop.
|
Represent an object of a platform. More...
#include <Object.h>
Public Member Functions | |
Object (const gd::String &name, const gd::String &type, std::unique_ptr< gd::ObjectConfiguration > configuration) | |
Object (const gd::String &name, const gd::String &type, gd::ObjectConfiguration *configuration) | |
Object (const gd::Object &object) | |
Object & | operator= (const gd::Object &object) |
virtual | ~Object () |
virtual std::unique_ptr< gd::Object > | Clone () const |
gd::ObjectConfiguration & | GetConfiguration () |
Return the object configuration. | |
const gd::ObjectConfiguration & | GetConfiguration () const |
Common properties | |
Members functions related to common properties | |
void | SetName (const gd::String &name_) |
Change the name of the object with the name passed as parameter. | |
const gd::String & | GetName () const |
Return the name of the object. | |
void | SetAssetStoreId (const gd::String &assetStoreId_) |
Change the asset store id of the object. | |
const gd::String & | GetAssetStoreId () const |
Return the asset store id of the object. | |
void | SetType (const gd::String &type_) |
Change the type of the object. | |
const gd::String & | GetType () const |
Return the type of the object. | |
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 object. | |
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 object 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. | |
Variable management | |
Members functions related to object variables management. | |
const gd::VariablesContainer & | GetVariables () const |
Provide access to the gd::VariablesContainer member containing the object variables. | |
gd::VariablesContainer & | GetVariables () |
Provide access to the gd::VariablesContainer member containing the object variables. | |
Effects management | |
Member functions related to effects management. | |
const gd::EffectsContainer & | GetEffects () const |
Provide access to the gd::EffectsContainer member containing the effects. | |
gd::EffectsContainer & | GetEffects () |
Provide access to the gd::EffectsContainer member containing the effects. | |
Serialization | |
Members functions related to serialization of the object | |
void | SerializeTo (SerializerElement &element) const |
Serialize the object. More... | |
void | UnserializeFrom (gd::Project &project, const SerializerElement &element) |
Unserialize the object. More... | |
Object & | ResetPersistentUuid () |
Reset the persistent UUID, used to recognize the same object between serialization. | |
Object & | ClearPersistentUuid () |
Remove the persistent UUID - when the object no longer need to be recognized between serializations. | |
Protected Member Functions | |
void | Init (const gd::Object &object) |
Protected Attributes | |
gd::String | name |
The full name of the object. | |
gd::String | assetStoreId |
std::unique_ptr< gd::ObjectConfiguration > | configuration |
std::map< gd::String, std::unique_ptr< gd::Behavior > > | behaviors |
gd::VariablesContainer | objectVariables |
List of the variables of the object. | |
gd::EffectsContainer | effectsContainer |
The effects container for the object. | |
gd::String | persistentUuid |
Represent an object of a platform.
gd::Object::Object | ( | const gd::String & | name, |
const gd::String & | type, | ||
std::unique_ptr< gd::ObjectConfiguration > | configuration | ||
) |
Create a new object with the name passed as argument.
gd::Object::Object | ( | const gd::String & | name, |
const gd::String & | type, | ||
gd::ObjectConfiguration * | configuration | ||
) |
Create a new object with the name passed as argument.
Object takes the ownership of the configuration.
|
inline |
Copy constructor. Calls Init().
|
virtual |
Destructor.
gd::Behavior * gd::Object::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.
|
inlinevirtual |
Must return a pointer to a copy of the object. A such method is needed to do polymorphic copies. Just redefine this method in your derived object class like this:
|
protected |
Initialize object using another object. 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::Object::RenameBehavior | ( | const gd::String & | name, |
const gd::String & | newName | ||
) |
Change the name of behavior called name to newName.
void gd::Object::SerializeTo | ( | SerializerElement & | element | ) | const |
Serialize the object.
void gd::Object::UnserializeFrom | ( | gd::Project & | project, |
const SerializerElement & | element | ||
) |
Unserialize the object.
|
protected |
The ID of the asset if the object comes from the store.
|
protected |
Contains all behaviors and their properties for the object. Behavior contents are the ownership of the object.
|
mutableprotected |
A persistent random version 4 UUID, useful for computing changesets.