GDevelop Core
Core library for developing platforms and tools compatible with GDevelop.
|
Represents an instance of an object to be created on a layout start up. More...
#include <InitialInstance.h>
Public Member Functions | |
InitialInstance () | |
Create an initial instance pointing to no object, at position (0,0). | |
InitialInstance * | Clone () const |
Common properties | |
Members functions related to common properties | |
const gd::String & | GetObjectName () const |
Get the name of object instantiated on the layout. | |
void | SetObjectName (const gd::String &name) |
Set the name of object instantiated on the layout. | |
double | GetX () const |
Get the X position of the instance. | |
void | SetX (double x_) |
Set the X position of the instance. | |
double | GetY () const |
Get the Y position of the instance. | |
void | SetY (double y_) |
Set the Y position of the instance. | |
double | GetZ () const |
Get the Z position of the instance. | |
void | SetZ (double z_) |
Set the Z position of the instance. | |
double | GetAngle () const |
Get the rotation of the instance on Z axis, in radians. | |
void | SetAngle (double angle_) |
Set the rotation of the instance on Z axis, in radians. | |
double | GetRotationX () const |
Get the rotation of the instance on X axis, in radians. | |
void | SetRotationX (double rotationX_) |
Set the rotation of the instance on X axis, in radians. | |
double | GetRotationY () const |
Get the rotation of the instance on Y axis, in radians. | |
void | SetRotationY (double rotationY_) |
Set the rotation of the instance on Y axis, in radians. | |
int | GetZOrder () const |
Get the Z order of the instance (for a 2D object). | |
void | SetZOrder (int zOrder_) |
Set the Z order of the instance (for a 2D object). | |
int | GetOpacity () const |
Get Opacity. | |
void | SetOpacity (int opacity_) |
Set the opacity of the instance. | |
bool | IsFlippedX () const |
Return true if the instance is flipped on X axis. | |
void | SetFlippedX (bool flippedX_) |
Set whether the instance is flipped on X axis. | |
bool | IsFlippedY () const |
Return true if the instance is flipped on Y axis. | |
void | SetFlippedY (bool flippedY_) |
Set whether the instance is flipped on Y axis. | |
bool | IsFlippedZ () const |
Return true if the instance is flipped on Z axis. | |
void | SetFlippedZ (bool flippedZ_) |
Set whether the instance is flipped on Z axis. | |
const gd::String & | GetLayer () const |
Get the layer the instance belongs to. | |
void | SetLayer (const gd::String &layer_) |
Set the layer the instance belongs to. | |
bool | HasCustomSize () const |
Return true if the instance has a width/height which is different from its object default width/height. This is independent from HasCustomDepth . More... | |
bool | HasCustomDepth () const |
Return true if the instance has a depth which is different from its object default depth. This is independent from HasCustomSize . More... | |
void | SetHasCustomSize (bool hasCustomSize_) |
Set whether the instance has a width/height which is different from its object default width/height or not. This is independent from SetHasCustomDepth . More... | |
void | SetHasCustomDepth (bool hasCustomDepth_) |
Set whether the instance has a depth which is different from its object default depth or not. This is independent from SetHasCustomSize . More... | |
double | GetCustomWidth () const |
void | SetCustomWidth (double width_) |
double | GetCustomHeight () const |
void | SetCustomHeight (double height_) |
double | GetCustomDepth () const |
void | SetCustomDepth (double depth_) |
bool | IsLocked () const |
Return true if the instance is locked and cannot be moved in the IDE. | |
void | SetLocked (bool enable=true) |
(Un)lock the initial instance. More... | |
bool | IsSealed () const |
Return true if the instance cannot be selected by clicking on it in the IDE (only applies if instance is also locked). | |
void | SetSealed (bool enable=true) |
(Un)seal the initial instance. More... | |
bool | ShouldKeepRatio () const |
Return true if the dimensions (width, height and depth) should keep the same ratio. | |
void | SetShouldKeepRatio (bool enable=true) |
Define if instance's dimensions should keep the same ratio. | |
Variable management | |
Members functions related to initial instance variables management. | |
const gd::VariablesContainer & | GetVariables () const |
gd::VariablesContainer & | GetVariables () |
Others properties management | |
Members functions related to exposing others properties of the instance.
However, objects can store custom properties for their associated initial instances. When the IDE want to get the custom properties, it will call
| |
std::map< gd::String, gd::PropertyDescriptor > | GetCustomProperties (gd::ObjectsContainer &globalObjectsContainer, gd::ObjectsContainer &objectsContainer) |
Return a map containing the properties names (as keys) and their values. More... | |
bool | UpdateCustomProperty (const gd::String &name, const gd::String &value, gd::ObjectsContainer &globalObjectsContainer, gd::ObjectsContainer &objectsContainer) |
Update the property called name with the new value. More... | |
double | GetRawDoubleProperty (const gd::String &name) const |
Get the value of a double property stored in the instance. More... | |
const gd::String & | GetRawStringProperty (const gd::String &name) const |
Get the value of a string property stored in the instance. More... | |
void | SetRawDoubleProperty (const gd::String &name, double value) |
Set the value of a double property stored in the instance. | |
void | SetRawStringProperty (const gd::String &name, const gd::String &value) |
Set the value of a string property stored in the instance. | |
Saving and loading | |
Members functions related to serialization. | |
virtual void | SerializeTo (SerializerElement &element) const |
Serialize instances container. | |
virtual void | UnserializeFrom (const SerializerElement &element) |
Unserialize the instances container. | |
InitialInstance & | ResetPersistentUuid () |
Reset the persistent UUID used to recognize the same initial instance between serialization. | |
Represents an instance of an object to be created on a layout start up.
|
inline |
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:
std::map< gd::String, gd::PropertyDescriptor > gd::InitialInstance::GetCustomProperties | ( | gd::ObjectsContainer & | globalObjectsContainer, |
gd::ObjectsContainer & | objectsContainer | ||
) |
Return a map containing the properties names (as keys) and their values.
double gd::InitialInstance::GetRawDoubleProperty | ( | const gd::String & | name | ) | const |
Get the value of a double property stored in the instance.
const gd::String & gd::InitialInstance::GetRawStringProperty | ( | const gd::String & | name | ) | const |
Get the value of a string property stored in the instance.
|
inline |
Must return a reference to the container storing the instance variables
|
inline |
Must return a reference to the container storing the instance variables
|
inline |
Return true if the instance has a depth which is different from its object default depth. This is independent from HasCustomSize
.
|
inline |
Return true if the instance has a width/height which is different from its object default width/height. This is independent from HasCustomDepth
.
|
inline |
Set whether the instance has a depth which is different from its object default depth or not. This is independent from SetHasCustomSize
.
hasCustomSize | true if the depth is different from the object's default depth. |
|
inline |
Set whether the instance has a width/height which is different from its object default width/height or not. This is independent from SetHasCustomDepth
.
|
inline |
(Un)lock the initial instance.
An instance which is locked cannot be moved with actions in the IDE.
|
inline |
(Un)seal the initial instance.
An instance which is sealed cannot be selected by clicking on it in a layout editor canvas.
bool gd::InitialInstance::UpdateCustomProperty | ( | const gd::String & | name, |
const gd::String & | value, | ||
gd::ObjectsContainer & | globalObjectsContainer, | ||
gd::ObjectsContainer & | objectsContainer | ||
) |
Update the property called name with the new value.