GDevelop Core
Core library for developing platforms and tools compatible with GDevelop.
|
Base class defining an event. More...
#include <Event.h>
Inherited by gd::AsyncEvent, gd::CommentEvent, gd::EmptyEvent, gd::ForEachChildVariableEvent, gd::ForEachEvent, gd::GroupEvent, gd::LinkEvent, gd::RepeatEvent, gd::StandardEvent, and gd::WhileEvent.
Public Member Functions | |
virtual gd::BaseEvent * | Clone () const |
Event properties | |
Members functions to be overridden by derived classes to expose the event properties | |
virtual bool | IsExecutable () const |
virtual bool | CanHaveSubEvents () const |
virtual const gd::EventsList & | GetSubEvents () const |
virtual gd::EventsList & | GetSubEvents () |
bool | HasSubEvents () const |
Return true if the events has sub events. More... | |
virtual bool | CanHaveVariables () const |
virtual const gd::VariablesContainer & | GetVariables () const |
virtual gd::VariablesContainer & | GetVariables () |
bool | HasVariables () const |
Return true if the events has local variables. More... | |
virtual std::vector< gd::InstructionsList * > | GetAllConditionsVectors () |
Return a list of all conditions of the event. More... | |
virtual std::vector< const gd::InstructionsList * > | GetAllConditionsVectors () const |
virtual std::vector< gd::InstructionsList * > | GetAllActionsVectors () |
Return a list of all actions of the event. More... | |
virtual std::vector< const gd::InstructionsList * > | GetAllActionsVectors () const |
virtual std::vector< gd::String > | GetAllSearchableStrings () const |
Return a list of all strings of the event. More... | |
virtual bool | ReplaceAllSearchableStrings (std::vector< gd::String > newSearchableString) |
virtual std::vector< std::pair< gd::Expression *, gd::ParameterMetadata > > | GetAllExpressionsWithMetadata () |
Return a list of all expressions of the event, each with their associated metadata. More... | |
virtual std::vector< std::pair< const gd::Expression *, const gd::ParameterMetadata > > | GetAllExpressionsWithMetadata () const |
virtual const std::vector< gd::String > & | GetSourceFileDependencies () const |
Returns the dependencies on source files of the project. More... | |
virtual const gd::String & | GetAssociatedGDManagedSourceFile (gd::Project &project) const |
Returns the name of the source file associated with the event. More... | |
Code generation | |
Members functions used to generate code from the event | |
virtual gd::String | GenerateEventCode (gd::EventsCodeGenerator &codeGenerator, gd::EventsCodeGenerationContext &context) |
Generate the code event: the platform provided by codeGenerator is asked for the EventMetadata associated to the event, which is then used to generate the code event. More... | |
virtual void | Preprocess (gd::EventsCodeGenerator &codeGenerator, gd::EventsList &eventList, std::size_t indexOfTheEventInThisList) |
void | PreprocessAsyncActions (const gd::Platform &platform) |
virtual bool | MustBePreprocessed () |
If MustBePreprocessed is redefined to return true, the gd::EventMetadata::preprocessing associated to the event will be called to preprocess the event. More... | |
Serialization | |
virtual void | SerializeTo (SerializerElement &element) const |
Serialize event. | |
virtual void | UnserializeFrom (gd::Project &project, const SerializerElement &element) |
Unserialize the event. | |
virtual bool | AcceptVisitor (gd::EventVisitor &eventVisitor) |
virtual void | AcceptVisitor (gd::ReadOnlyEventVisitor &eventVisitor) const |
Common properties | |
Common method shared by all events. ( No need for them to be overridden by derived classes ). | |
const gd::String & | GetType () const |
Return the event type. | |
void | SetType (gd::String type_) |
Change the event type. | |
void | SetDisabled (bool disable=true) |
Set if the event if disabled or not. | |
bool | IsDisabled () const |
True if event is disabled. | |
void | SetFolded (bool fold=true) |
Set if the event must be folded (i.e: sub events must be hidden in the events editor). | |
bool | IsFolded () const |
True if the event should be folded in the events editor. | |
Public Attributes | |
std::weak_ptr< gd::BaseEvent > | originalEvent |
signed long long | totalTimeDuringLastSession |
float | percentDuringLastSession |
Base class defining an event.
Events are usually not instance of Base Event, but instance of a derived class.
|
inlinevirtual |
Derived class have to redefine this function, so as to return true, if they have sub events.
Reimplemented in gd::WhileEvent, gd::StandardEvent, gd::RepeatEvent, gd::GroupEvent, gd::ForEachEvent, gd::ForEachChildVariableEvent, and gd::AsyncEvent.
|
inlinevirtual |
Derived class have to redefine this function, so as to return true, if they can have local variables.
Reimplemented in gd::StandardEvent.
|
inlinevirtual |
Must return a pointer to a copy of the event. A such method is needed as the IDE may want to store copies of some events and so need a way to do polymorphic copies.
Typical implementation example:
Reimplemented in gd::LinkEvent, gd::WhileEvent, gd::StandardEvent, gd::RepeatEvent, gd::GroupEvent, gd::ForEachEvent, gd::ForEachChildVariableEvent, gd::CommentEvent, and gd::AsyncEvent.
|
virtual |
Generate the code event: the platform provided by codeGenerator is asked for the EventMetadata associated to the event, which is then used to generate the code event.
|
inlinevirtual |
Return a list of all actions of the event.
Reimplemented in gd::WhileEvent, gd::StandardEvent, gd::RepeatEvent, gd::ForEachEvent, gd::ForEachChildVariableEvent, and gd::AsyncEvent.
|
inlinevirtual |
Return a list of all conditions of the event.
Reimplemented in gd::WhileEvent, gd::StandardEvent, gd::RepeatEvent, gd::ForEachEvent, and gd::ForEachChildVariableEvent.
|
inlinevirtual |
Return a list of all expressions of the event, each with their associated metadata.
Reimplemented in gd::RepeatEvent, gd::ForEachEvent, and gd::ForEachChildVariableEvent.
|
inlinevirtual |
Return a list of all strings of the event.
Reimplemented in gd::GroupEvent, and gd::CommentEvent.
|
inlinevirtual |
Returns the name of the source file associated with the event.
|
inlinevirtual |
Returns the dependencies on source files of the project.
|
inlinevirtual |
Return the sub events, if applicable.
Reimplemented in gd::WhileEvent, gd::StandardEvent, gd::RepeatEvent, gd::GroupEvent, gd::ForEachEvent, gd::ForEachChildVariableEvent, and gd::AsyncEvent.
|
inlinevirtual |
Return the sub events, if applicable.
Reimplemented in gd::WhileEvent, gd::StandardEvent, gd::RepeatEvent, gd::GroupEvent, gd::ForEachEvent, gd::ForEachChildVariableEvent, and gd::AsyncEvent.
|
inlinevirtual |
Return the local variables, if applicable.
Reimplemented in gd::StandardEvent.
|
inlinevirtual |
Return the local variables, if applicable.
Reimplemented in gd::StandardEvent.
bool gd::BaseEvent::HasSubEvents | ( | ) | const |
Return true if the events has sub events.
bool gd::BaseEvent::HasVariables | ( | ) | const |
Return true if the events has local variables.
|
inlinevirtual |
Derived class have to redefine this function, so as to return true, if they are executable.
Reimplemented in gd::LinkEvent, gd::WhileEvent, gd::StandardEvent, gd::RepeatEvent, gd::GroupEvent, gd::ForEachEvent, gd::ForEachChildVariableEvent, and gd::AsyncEvent.
|
inlinevirtual |
If MustBePreprocessed is redefined to return true, the gd::EventMetadata::preprocessing associated to the event will be called to preprocess the event.
Reimplemented in gd::LinkEvent.
|
virtual |
Called before events are compiled: the platform provided by codeGenerator is asked for the EventMetadata associated to the event, which is then used to preprocess the event.
This is only done if the event MustBePreprocessed() return true.
void gd::BaseEvent::PreprocessAsyncActions | ( | const gd::Platform & | platform | ) |
A function that turns all async member actions into an Async subevent for code generation.
std::weak_ptr<gd::BaseEvent> gd::BaseEvent::originalEvent |
Pointer only used for profiling events, so as to remember the original event from which it has been copied.
float gd::BaseEvent::percentDuringLastSession |
Total time used by the event during the last run. Used for profiling.
signed long long gd::BaseEvent::totalTimeDuringLastSession |
Total time, in microseconds, used by the event during the last run. Used for profiling.