GDevelop Core
Core library for developing platforms and tools compatible with GDevelop.
AsyncEvent.h
1 /*
2  * GDevelop Core
3  * Copyright 2008-2016 Florian Rival ([email protected]). All rights
4  * reserved. This project is released under the MIT License.
5  */
6 
7 #ifndef GDCORE_ASYNCEVENT_H
8 #define GDCORE_ASYNCEVENT_H
9 #include "GDCore/Events/Event.h"
10 #include "GDCore/Events/EventsList.h"
11 #include "GDCore/Events/Instruction.h"
12 #include "GDCore/Events/InstructionsList.h"
13 namespace gd {
14 class Instruction;
15 class Project;
16 } // namespace gd
17 
18 namespace gd {
19 
25 class GD_CORE_API AsyncEvent : public gd::BaseEvent {
26 public:
27  AsyncEvent();
28  AsyncEvent(const gd::Instruction &asyncAction_,
29  const gd::InstructionsList &actions_,
30  const gd::EventsList &subEvents_)
31  : asyncAction(asyncAction_), actions(actions_), subEvents(subEvents_) {
32  SetType("BuiltinAsync::Async");
33  };
34  virtual ~AsyncEvent();
35  virtual gd::AsyncEvent *Clone() const { return new AsyncEvent(*this); }
36 
37  virtual bool IsExecutable() const { return true; }
38 
39  virtual bool CanHaveSubEvents() const { return true; }
40  virtual const gd::EventsList &GetSubEvents() const { return subEvents; };
41  virtual gd::EventsList &GetSubEvents() { return subEvents; };
42 
43  const gd::InstructionsList &GetActions() const { return actions; };
44  gd::InstructionsList &GetActions() { return actions; };
45 
46  const gd::Instruction &GetInstruction() const { return asyncAction; };
47  gd::Instruction &GetInstruction() { return asyncAction; };
48 
49  virtual std::vector<const gd::InstructionsList *>
50  GetAllActionsVectors() const;
51  virtual std::vector<gd::InstructionsList *> GetAllActionsVectors();
52 
53 private:
54  gd::Instruction asyncAction;
55  gd::InstructionsList actions;
56  EventsList subEvents;
57 };
58 
59 } // namespace gd
60 
61 #endif // GDCORE_STANDARDEVENT_H
Internal event for asynchronous actions. This event gets added internally to the events tree when an ...
Definition: AsyncEvent.h:25
virtual bool CanHaveSubEvents() const
Definition: AsyncEvent.h:39
virtual bool IsExecutable() const
Definition: AsyncEvent.h:37
virtual gd::AsyncEvent * Clone() const
Definition: AsyncEvent.h:35
virtual gd::EventsList & GetSubEvents()
Definition: AsyncEvent.h:41
virtual const gd::EventsList & GetSubEvents() const
Definition: AsyncEvent.h:40
Base class defining an event.
Definition: Event.h:44
A list of events.
Definition: EventsList.h:33
An instruction is a member of an event: It can be a condition or an action.
Definition: Instruction.h:30
Definition: InstructionsList.h:25
Definition: CommonTools.h:24