GDevelop Core
Core library for developing platforms and tools compatible with GDevelop.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
Public Member Functions | List of all members
gd::Resource Class Reference

Base class to describe a resource used by a game. More...

#include <ResourcesManager.h>

Inherited by gd::AudioResource, gd::FontResource, gd::ImageResource, gd::JsonResource, and gd::VideoResource.

Public Member Functions

virtual ResourceClone () const
 
virtual void SetName (const gd::String &name_)
 Change the name of the resource with the name passed as parameter.
 
virtual const gd::StringGetName () const
 Return the name of the resource.
 
virtual void SetKind (const gd::String &newKind)
 Change the kind of the resource.
 
virtual const gd::StringGetKind () const
 Return the kind of the resource.
 
virtual void SetUserAdded (bool isUserAdded)
 Change if the resource is user added or not.
 
virtual bool IsUserAdded () const
 Return true if the resource was added by the user.
 
virtual bool UseFile ()
 Return true if the resource use a file. More...
 
virtual const gd::StringGetFile () const
 Return, if applicable, the String containing the file used by the resource. The file is relative to the project directory. More...
 
virtual void SetFile (const gd::String &newFile)
 Change, if applicable, the file of the resource. More...
 
virtual void SetMetadata (const gd::String &metadata_)
 Set the metadata (any string) associated to the resource. More...
 
virtual const gd::StringGetMetadata () const
 Return the (optional) metadata associated to the resource.
 
virtual void SerializeTo (SerializerElement &element) const
 Serialize the object.
 
virtual void UnserializeFrom (const SerializerElement &element)
 Unserialize the objectt.
 
Resources properties

Reading and updating resources properties

virtual std::map< gd::String,
gd::PropertyDescriptor
GetProperties (gd::Project &project) const
 Called when the IDE wants to know about the custom properties of the resource. More...
 
virtual bool UpdateProperty (const gd::String &name, const gd::String &value, gd::Project &project)
 Called when the IDE wants to update a custom property of the resource. More...
 

Detailed Description

Base class to describe a resource used by a game.

Member Function Documentation

virtual const gd::String& gd::Resource::GetFile ( ) const
inlinevirtual

Return, if applicable, the String containing the file used by the resource. The file is relative to the project directory.

See also
gd::Resource::UseFile
gd::Resource::SetFile

Reimplemented in gd::JsonResource, gd::VideoResource, gd::FontResource, gd::AudioResource, and gd::ImageResource.

std::map< gd::String, gd::PropertyDescriptor > gd::Resource::GetProperties ( gd::Project project) const
virtual

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

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 in gd::JsonResource, and gd::ImageResource.

virtual void gd::Resource::SetFile ( const gd::String newFile)
inlinevirtual

Change, if applicable, the file of the resource.

See also
gd::Resource::UseFile
gd::Resource::GetFile

Reimplemented in gd::JsonResource, gd::VideoResource, gd::FontResource, gd::AudioResource, and gd::ImageResource.

virtual void gd::Resource::SetMetadata ( const gd::String metadata_)
inlinevirtual

Set the metadata (any string) associated to the resource.

Note
Can be used by external editors to store extra information, for example the configuration used to produce a sound.
virtual bool gd::Resource::UpdateProperty ( const gd::String name,
const gd::String value,
gd::Project project 
)
inlinevirtual

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

Returns
false if the new value cannot be set

Reimplemented in gd::JsonResource, and gd::ImageResource.

virtual bool gd::Resource::UseFile ( )
inlinevirtual

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