GDevelop Core
Core library for developing platforms and tools compatible with GDevelop.
Public Member Functions | List of all members
gd::SpriteObject Class Reference

Standard sprite object for extensions that implements the standard SpriteExtension (see gd::BuiltinExtensionsImplementer::ImplementsSpriteExtension). More...

#include <SpriteObject.h>

Inherits gd::ObjectConfiguration.

Public Member Functions

std::unique_ptr< gd::ObjectConfigurationClone () const override
 
void ExposeResources (gd::ArbitraryResourceWorker &worker) override
 Called ( e.g. during compilation ) so as to inventory internal resources and sometimes update their filename. Implementation example: More...
 
std::map< gd::String, gd::PropertyDescriptorGetProperties () const override
 Called when the IDE wants to know about the custom properties of the object configuration. More...
 
bool UpdateProperty (const gd::String &name, const gd::String &value) override
 Called when the IDE wants to update a custom property of the object configuration. More...
 
std::map< gd::String, gd::PropertyDescriptorGetInitialInstanceProperties (const gd::InitialInstance &position, gd::Project &project, gd::Layout &scene) override
 Called when the IDE wants to know about the custom properties of an initial instance of this object configuration. More...
 
bool UpdateInitialInstanceProperty (gd::InitialInstance &position, const gd::String &name, const gd::String &value, gd::Project &project, gd::Layout &scene) override
 Called when the IDE wants to update a custom property of an initial instance of this object configuration. More...
 
const SpriteAnimationListGetAnimations () const
 Return the animation configuration.
 
SpriteAnimationListGetAnimations ()
 Return the animation configuration.
 
void SetUpdateIfNotVisible (bool updateIfNotVisible_)
 Set if the object animation should be played even if the object is hidden or far from the camera.
 
bool GetUpdateIfNotVisible () const
 Check if the object animation should be played even if the object is hidden or far from the camera (false by default).
 
- Public Member Functions inherited from gd::ObjectConfiguration
 ObjectConfiguration ()
 
virtual ~ObjectConfiguration ()
 
void SetType (const gd::String &type_)
 Change the type of the object.
 
const gd::StringGetType () const
 Return the type of the object.
 
void SerializeTo (SerializerElement &element) const
 Serialize the object configuration. More...
 
void UnserializeFrom (gd::Project &project, const SerializerElement &element)
 Unserialize the object configuration. More...
 

Additional Inherited Members

- Protected Attributes inherited from gd::ObjectConfiguration
gd::String type
 

Detailed Description

Standard sprite object for extensions that implements the standard SpriteExtension (see gd::BuiltinExtensionsImplementer::ImplementsSpriteExtension).

A Sprite object is an object composed of animations, containing directions with images.

See also
Animation
Direction
Sprite
gd::BuiltinExtensionsImplementer::ImplementsSpriteExtension

Member Function Documentation

◆ Clone()

std::unique_ptr<gd::ObjectConfiguration> gd::SpriteObject::Clone ( ) const
inlineoverridevirtual

Must return a pointer to a copy of the configuration. This method is needed to do polymorphic copies. Just redefine this method in your derived object class like this:

return gd::make_unique<MyObjectConfiguration>(*this);

Reimplemented from gd::ObjectConfiguration.

◆ ExposeResources()

void gd::SpriteObject::ExposeResources ( gd::ArbitraryResourceWorker worker)
overridevirtual

Called ( e.g. during compilation ) so as to inventory internal resources and sometimes update their filename. Implementation example:

worker.ExposeImage(myImage);
worker.ExposeFile(myResourceFile);
See also
ArbitraryResourceWorker

Reimplemented from gd::ObjectConfiguration.

◆ GetInitialInstanceProperties()

std::map< gd::String, gd::PropertyDescriptor > gd::SpriteObject::GetInitialInstanceProperties ( const gd::InitialInstance instance,
gd::Project project,
gd::Layout layout 
)
overridevirtual

Called when the IDE wants to know about the custom properties of an initial instance of this object configuration.

Returns
a std::map with properties names as key and values.
See also
gd::InitialInstance

Reimplemented from gd::ObjectConfiguration.

◆ GetProperties()

std::map< gd::String, gd::PropertyDescriptor > gd::SpriteObject::GetProperties ( ) const
overridevirtual

Called when the IDE wants to know about the custom properties of the object configuration.

Usage example:

std::map<gd::String, gd::PropertyDescriptor> properties;
properties[ToString(_("Text"))].SetValue("Hello world!");
return properties;
Returns
a std::map with properties names as key.
See also
gd::PropertyDescriptor

Reimplemented from gd::ObjectConfiguration.

◆ UpdateInitialInstanceProperty()

bool gd::SpriteObject::UpdateInitialInstanceProperty ( gd::InitialInstance instance,
const gd::String name,
const gd::String value,
gd::Project project,
gd::Layout layout 
)
overridevirtual

Called when the IDE wants to update a custom property of an initial instance of this object configuration.

Returns
false if the new value cannot be set
See also
gd::InitialInstance

Reimplemented from gd::ObjectConfiguration.

◆ UpdateProperty()

bool gd::SpriteObject::UpdateProperty ( const gd::String name,
const gd::String value 
)
overridevirtual

Called when the IDE wants to update a custom property of the object configuration.

Returns
false if the new value cannot be set

Reimplemented from gd::ObjectConfiguration.


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