GDevelop Core
Core library for developing platforms and tools compatible with GDevelop.
Static Public Member Functions | Public Attributes | List of all members

Base class for implementing platform's extensions. More...

#include <PlatformExtension.h>

Public Member Functions

Extension setup

Common setup for all extensions

PlatformExtensionSetExtensionInformation (const gd::String &name_, const gd::String &fullname_, const gd::String &description_, const gd::String &author_, const gd::String &license_)
 Must be called to declare the main information about the extension.
 
PlatformExtensionSetIconUrl (const gd::String &iconUrl_)
 Set the URL of the extension icon.
 
PlatformExtensionSetCategory (const gd::String &category_)
 Set the category of the extension.
 
PlatformExtensionSetExtensionHelpPath (const gd::String &helpPath_)
 Set the path to the help, relative to the GDevelop documentation root. For example, "/all-features/collisions" for "https://wiki.gdevelop.io/gdevelop5/all-features/collisions". More...
 
void MarkAsDeprecated ()
 Mark this extension as deprecated: the IDE will hide it from the user.
 
Features declaration

Declare features provided by the extension

gd::InstructionMetadataAddCondition (const gd::String &name_, const gd::String &fullname_, const gd::String &description_, const gd::String &sentence_, const gd::String &group_, const gd::String &icon_, const gd::String &smallicon_)
 Declare a new condition as being part of the extension.
 
gd::InstructionMetadataAddAction (const gd::String &name_, const gd::String &fullname_, const gd::String &description_, const gd::String &sentence_, const gd::String &group_, const gd::String &icon_, const gd::String &smallicon_)
 Declare a new action as being part of the extension.
 
gd::ExpressionMetadataAddExpression (const gd::String &name_, const gd::String &fullname_, const gd::String &description_, const gd::String &group_, const gd::String &smallicon_)
 Declare a new expression as being part of the extension.
 
gd::ExpressionMetadataAddStrExpression (const gd::String &name_, const gd::String &fullname_, const gd::String &description_, const gd::String &group_, const gd::String &smallicon_)
 Declare a new string expression as being part of the extension.
 
gd::MultipleInstructionMetadata AddExpressionAndCondition (const gd::String &type, const gd::String &name, const gd::String &fullname, const gd::String &description, const gd::String &sentenceName, const gd::String &group, const gd::String &icon)
 Declare a new expression and condition as being part of the extension. More...
 
gd::MultipleInstructionMetadata AddExpressionAndConditionAndAction (const gd::String &type, const gd::String &name, const gd::String &fullname, const gd::String &description, const gd::String &sentenceName, const gd::String &group, const gd::String &icon)
 Declare a new expression, condition and action as being part of the extension. More...
 
gd::DependencyMetadataAddDependency ()
 
template<class T >
gd::ObjectMetadataAddObject (const gd::String &name_, const gd::String &fullname_, const gd::String &description_, const gd::String &icon_)
 Declare a new object as being part of the extension. More...
 
gd::ObjectMetadataAddObject (const gd::String &name_, const gd::String &fullname_, const gd::String &description_, const gd::String &icon_, std::shared_ptr< gd::ObjectConfiguration > instance)
 Declare a new object as being part of the extension. More...
 
gd::ObjectMetadataAddEventsBasedObject (const gd::String &name_, const gd::String &fullname_, const gd::String &description_, const gd::String &icon_)
 Declare a new events based object as being part of the extension. More...
 
gd::BehaviorMetadataAddBehavior (const gd::String &name_, const gd::String &fullname_, const gd::String &defaultName_, const gd::String &description_, const gd::String &group_, const gd::String &icon_, const gd::String &className_, std::shared_ptr< gd::Behavior > instance, std::shared_ptr< gd::BehaviorsSharedData > sharedDatasInstance)
 Declare a new behavior as being part of the extension. More...
 
gd::EffectMetadataAddEffect (const gd::String &name_)
 Declare a new effect as being part of the extension. More...
 
gd::EventMetadataAddEvent (const gd::String &name_, const gd::String &fullname_, const gd::String &description_, const gd::String &group_, const gd::String &smallicon_, std::shared_ptr< gd::BaseEvent > instance)
 Declare a new event as being part of the extension.
 
gd::InstructionMetadataAddDuplicatedAction (const gd::String &newActionName, const gd::String &copiedActionName)
 Create a new action which is the duplicate of the specified one. More...
 
gd::InstructionMetadataAddDuplicatedCondition (const gd::String &newConditionName, const gd::String &copiedConditionName, gd::DuplicatedInstructionOptions options={.unscoped=false})
 Create a new condition which is the duplicate of the specified one. More...
 
gd::ExpressionMetadataAddDuplicatedExpression (const gd::String &newExpressionName, const gd::String &copiedExpressionName)
 Create a new expression which is the duplicate of the specified one. More...
 
gd::ExpressionMetadataAddDuplicatedStrExpression (const gd::String &newExpressionName, const gd::String &copiedExpressionName)
 Create a new string expression which is the duplicate of the specified one. More...
 
gd::PropertyDescriptorRegisterProperty (const gd::String &name)
 Adds a property to the extension.
 
InstructionOrExpressionGroupMetadataAddInstructionOrExpressionGroupMetadata (const gd::String &name)
 Add some metadata (icon, etc...) for a group used for instructions or expressions.
 
void StripUnimplementedInstructionsAndExpressions ()
 Delete all instructions having no function name or custom code generator.
 
Extension accessors

Accessors to read the information and content of the extension.

const gd::StringGetFullName () const
 Return the name extension user friendly name.
 
const gd::StringGetName () const
 Return the name of the extension.
 
const gd::StringGetCategory () const
 Return the category of the extension.
 
const gd::StringGetDescription () const
 Return a description of the extension.
 
const gd::StringGetAuthor () const
 Return the name of the extension developer.
 
const gd::StringGetLicense () const
 Return the name of extension license.
 
const gd::StringGetHelpPath () const
 Return the help path of extension, relative to the GDevelop documentation root.
 
const gd::StringGetIconUrl () const
 Return the URL to the icon to be displayed for this extension.
 
const std::vector< gd::String > & GetTags () const
 Return keywords that help search engines find this extension.
 
PlatformExtensionSetTags (const gd::String &csvTags)
 Set keywords that help search engines find this extension.
 
PlatformExtensionAddTag (const gd::String &tag)
 Add a keyword that help search engines find this extension.
 
bool IsDeprecated () const
 Check if the extension is flagged as being deprecated.
 
bool IsBuiltin () const
 Return true if the extension is a standard extension that cannot be deactivated.
 
const gd::StringGetNameSpace ()
 Get the namespace of the extension. More...
 
std::vector< gd::StringGetExtensionObjectsTypes () const
 Return a vector containing all the object types provided by the extension.
 
std::vector< gd::StringGetBehaviorsTypes () const
 Return a vector containing all the behavior types provided by the extension.
 
CreateFunPtr GetObjectCreationFunctionPtr (const gd::String &objectType) const
 Return a function to create the object if the type is handled by the extension.
 
std::vector< gd::StringGetExtensionEffectTypes () const
 Return a vector containing all the effect types provided by the extension.
 
std::shared_ptr< gd::BaseEventCreateEvent (const gd::String &eventType) const
 Create a custom event. More...
 
gd::BehaviorGetBehavior (const gd::String &behaviorType) const
 Get the gd::Behavior handling the given behavior type. More...
 
gd::BehaviorsSharedDataGetBehaviorSharedDatas (const gd::String &behaviorType) const
 Get the gd::BehaviorsSharedData handling the given behavior shared data. More...
 
ObjectMetadataGetObjectMetadata (const gd::String &objectType)
 Return a reference to the ObjectMetadata object associated to objectType.
 
BehaviorMetadataGetBehaviorMetadata (const gd::String &behaviorType)
 Return a reference to the BehaviorMetadata object associated to behaviorType.
 
bool HasBehavior (const gd::String &behaviorType) const
 Return true if the extension contains a behavior associated to behaviorType.
 
EffectMetadataGetEffectMetadata (const gd::String &effectName)
 Return the metadata for the effect with the given name.
 
std::map< gd::String, gd::EventMetadata > & GetAllEvents ()
 Return a map containing all the events provided by the extension.
 
std::map< gd::String, gd::InstructionMetadata > & GetAllActions ()
 Return a reference to a map containing the names of the actions (as keys) and the metadata associated with (as values).
 
std::map< gd::String, gd::InstructionMetadata > & GetAllConditions ()
 
std::map< gd::String, gd::ExpressionMetadata > & GetAllExpressions ()
 
std::map< gd::String, gd::ExpressionMetadata > & GetAllStrExpressions ()
 
std::vector< gd::DependencyMetadata > & GetAllDependencies ()
 Return a reference to a vector containing the metadata of all the dependencies of the extension.
 
std::map< gd::String, gd::InstructionMetadata > & GetAllActionsForObject (gd::String objectType)
 Return a reference to a map containing the names of the actions, related to the object type, and the metadata associated with.
 
std::map< gd::String, gd::InstructionMetadata > & GetAllConditionsForObject (gd::String objectType)
 
std::map< gd::String, gd::ExpressionMetadata > & GetAllExpressionsForObject (gd::String objectType)
 
std::map< gd::String, gd::ExpressionMetadata > & GetAllStrExpressionsForObject (gd::String objectType)
 
std::map< gd::String, gd::InstructionMetadata > & GetAllActionsForBehavior (gd::String autoType)
 
std::map< gd::String, gd::InstructionMetadata > & GetAllConditionsForBehavior (gd::String autoType)
 
std::map< gd::String, gd::ExpressionMetadata > & GetAllExpressionsForBehavior (gd::String autoType)
 
std::map< gd::String, gd::ExpressionMetadata > & GetAllStrExpressionsForBehavior (gd::String autoType)
 
std::map< gd::String, gd::PropertyDescriptor > & GetAllProperties ()
 Get all the properties of the extension. Properties are shown in the game properties in the editor, and are exported in the project data.
 
const std::map< gd::String, InstructionOrExpressionGroupMetadata > & GetAllInstructionOrExpressionGroupMetadata () const
 Get the metadata (icon, etc...) for groups used for instructions or expressions.
 

Static Public Member Functions

static std::vector< gd::StringGetBuiltinExtensionsNames ()
 Return the name of all the extensions which are considered provided by platforms.
 
static gd::String GetNamespaceSeparator ()
 Get the string used to separate the name of the instruction/expression and the extension.
 
static gd::String GetEventsFunctionFullType (const gd::String &extensionName, const gd::String &functionName)
 
static gd::String GetBehaviorEventsFunctionFullType (const gd::String &extensionName, const gd::String &behaviorName, const gd::String &functionName)
 
static gd::String GetBehaviorFullType (const gd::String &extensionName, const gd::String &behaviorName)
 
static gd::String GetObjectEventsFunctionFullType (const gd::String &extensionName, const gd::String &objectName, const gd::String &functionName)
 
static gd::String GetObjectFullType (const gd::String &extensionName, const gd::String &objectName)
 

Public Attributes

CompilationInfo compilationInfo
 

Detailed Description

Base class for implementing platform's extensions.

Member Function Documentation

◆ AddBehavior()

gd::BehaviorMetadata & gd::PlatformExtension::AddBehavior ( const gd::String name_,
const gd::String fullname_,
const gd::String defaultName_,
const gd::String description_,
const gd::String group_,
const gd::String icon_,
const gd::String className_,
std::shared_ptr< gd::Behavior instance,
std::shared_ptr< gd::BehaviorsSharedData sharedDatasInstance 
)

Declare a new behavior as being part of the extension.

Parameters
nameThe name of the behavior
fullnameThe user friendly name of the behavior
defaultNameThe default name of behavior instances
descriptionThe user friendly description of the behavior
groupThe behavior category label
iconThe icon of the behavior.
classNameThe name of the class implementing the behavior
instanceAn instance of the behavior that will be used to create the behavior
sharedDatasInstanceOptional instance of the data shared by the behaviors having the same name.

◆ AddDuplicatedAction()

gd::InstructionMetadata & gd::PlatformExtension::AddDuplicatedAction ( const gd::String newActionName,
const gd::String copiedActionName 
)

Create a new action which is the duplicate of the specified one.

Useful for handling a deprecated action that is just a "copy" of the new one.

◆ AddDuplicatedCondition()

gd::InstructionMetadata & gd::PlatformExtension::AddDuplicatedCondition ( const gd::String newConditionName,
const gd::String copiedConditionName,
gd::DuplicatedInstructionOptions  options = {.unscoped = false} 
)

Create a new condition which is the duplicate of the specified one.

Useful for handling a deprecated condition that is just a "copy" of the new one.

◆ AddDuplicatedExpression()

gd::ExpressionMetadata & gd::PlatformExtension::AddDuplicatedExpression ( const gd::String newExpressionName,
const gd::String copiedExpressionName 
)

Create a new expression which is the duplicate of the specified one.

Useful for handling a deprecated expression that is just a "copy" of the new one.

◆ AddDuplicatedStrExpression()

gd::ExpressionMetadata & gd::PlatformExtension::AddDuplicatedStrExpression ( const gd::String newExpressionName,
const gd::String copiedExpressionName 
)

Create a new string expression which is the duplicate of the specified one.

Useful for handling a deprecated string expression that is just a "copy" of the new one.

◆ AddEffect()

gd::EffectMetadata & gd::PlatformExtension::AddEffect ( const gd::String name_)

Declare a new effect as being part of the extension.

Parameters
nameThe internal name of the effect (also called effect type).

◆ AddEventsBasedObject()

gd::ObjectMetadata & gd::PlatformExtension::AddEventsBasedObject ( const gd::String name_,
const gd::String fullname_,
const gd::String description_,
const gd::String icon_ 
)

Declare a new events based object as being part of the extension.

Parameters
nameThe name of the object
fullnameThe user friendly name of the object
descriptionThe user friendly description of the object
iconThe icon of the object.

◆ AddExpressionAndCondition()

gd::MultipleInstructionMetadata gd::PlatformExtension::AddExpressionAndCondition ( const gd::String type,
const gd::String name,
const gd::String fullname,
const gd::String description,
const gd::String sentenceName,
const gd::String group,
const gd::String icon 
)

Declare a new expression and condition as being part of the extension.

Note
It's recommended to use this function to avoid declaring twice a similar expression/condition.

◆ AddExpressionAndConditionAndAction()

gd::MultipleInstructionMetadata gd::PlatformExtension::AddExpressionAndConditionAndAction ( const gd::String type,
const gd::String name,
const gd::String fullname,
const gd::String description,
const gd::String sentenceName,
const gd::String group,
const gd::String icon 
)

Declare a new expression, condition and action as being part of the extension.

Note
The action name is prefixed by "Set" (and the namespace, as the condition and the expression).
It's recommended to use this function to avoid declaring 3 times a similar expression/condition/action.

◆ AddObject() [1/2]

template<class T >
gd::ObjectMetadata & gd::PlatformExtension::AddObject ( const gd::String name_,
const gd::String fullname_,
const gd::String description_,
const gd::String icon_ 
)

Declare a new object as being part of the extension.

Template Parameters
Tthe declared class inherited from gd::Object
Parameters
nameThe name of the object.
fullnameThe user friendly name of the object.
descriptionThe user friendly description of the object.
iconThe icon of the object.

◆ AddObject() [2/2]

gd::ObjectMetadata & gd::PlatformExtension::AddObject ( const gd::String name_,
const gd::String fullname_,
const gd::String description_,
const gd::String icon_,
std::shared_ptr< gd::ObjectConfiguration instance 
)

Declare a new object as being part of the extension.

Parameters
nameThe name of the object
fullnameThe user friendly name of the object
descriptionThe user friendly description of the object
iconThe icon of the object.
instanceThe "blueprint" object to be copied when a new object is asked for.

◆ CreateEvent()

gd::BaseEventSPtr gd::PlatformExtension::CreateEvent ( const gd::String eventType) const

Create a custom event.

Return an empty pointer if eventType is not provided by the extension.

◆ GetAllActionsForBehavior()

std::map< gd::String, gd::InstructionMetadata > & gd::PlatformExtension::GetAllActionsForBehavior ( gd::String  autoType)

◆ GetAllConditions()

std::map< gd::String, gd::InstructionMetadata > & gd::PlatformExtension::GetAllConditions ( )

◆ GetAllConditionsForBehavior()

std::map< gd::String, gd::InstructionMetadata > & gd::PlatformExtension::GetAllConditionsForBehavior ( gd::String  autoType)

◆ GetAllConditionsForObject()

std::map< gd::String, gd::InstructionMetadata > & gd::PlatformExtension::GetAllConditionsForObject ( gd::String  objectType)

◆ GetAllExpressions()

std::map< gd::String, gd::ExpressionMetadata > & gd::PlatformExtension::GetAllExpressions ( )

◆ GetAllExpressionsForBehavior()

std::map< gd::String, gd::ExpressionMetadata > & gd::PlatformExtension::GetAllExpressionsForBehavior ( gd::String  autoType)

◆ GetAllExpressionsForObject()

std::map< gd::String, gd::ExpressionMetadata > & gd::PlatformExtension::GetAllExpressionsForObject ( gd::String  objectType)

◆ GetAllStrExpressions()

std::map< gd::String, gd::ExpressionMetadata > & gd::PlatformExtension::GetAllStrExpressions ( )

◆ GetAllStrExpressionsForBehavior()

std::map< gd::String, gd::ExpressionMetadata > & gd::PlatformExtension::GetAllStrExpressionsForBehavior ( gd::String  autoType)

◆ GetAllStrExpressionsForObject()

std::map< gd::String, gd::ExpressionMetadata > & gd::PlatformExtension::GetAllStrExpressionsForObject ( gd::String  objectType)

◆ GetBehavior()

gd::Behavior * gd::PlatformExtension::GetBehavior ( const gd::String behaviorType) const

Get the gd::Behavior handling the given behavior type.

Return nullptr if behaviorType is not provided by the extension.

◆ GetBehaviorSharedDatas()

gd::BehaviorsSharedData * gd::PlatformExtension::GetBehaviorSharedDatas ( const gd::String behaviorType) const

Get the gd::BehaviorsSharedData handling the given behavior shared data.

Return nullptr if behaviorType is not provided by the extension.

◆ GetNameSpace()

const gd::String& gd::PlatformExtension::GetNameSpace ( )
inline

Get the namespace of the extension.

Note
The namespace is simply the name of the extension concatenated with "::" at the end.

◆ SetExtensionHelpPath()

PlatformExtension& gd::PlatformExtension::SetExtensionHelpPath ( const gd::String helpPath_)
inline

Set the path to the help, relative to the GDevelop documentation root. For example, "/all-features/collisions" for "https://wiki.gdevelop.io/gdevelop5/all-features/collisions".

The instructions, objects and behaviors will have this help path set by default, unless you call SetHelpPath on them.


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