GDevelop Core
Core library for developing platforms and tools compatible with GDevelop.
RepeatEvent.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 #pragma once
8 
9 #include "GDCore/Events/Event.h"
10 #include "GDCore/Events/EventsList.h"
11 namespace gd {
12 class Instruction;
13 class Project;
14 }
15 
16 namespace gd {
17 
21 class GD_CORE_API RepeatEvent : public gd::BaseEvent {
22  public:
23  RepeatEvent();
24  virtual ~RepeatEvent(){};
25  virtual gd::RepeatEvent* Clone() const { return new RepeatEvent(*this); }
26 
27  virtual bool IsExecutable() const { return true; }
28 
29  virtual bool CanHaveSubEvents() const { return true; }
30  virtual const gd::EventsList& GetSubEvents() const { return events; };
31  virtual gd::EventsList& GetSubEvents() { return events; };
32 
33  const gd::InstructionsList& GetConditions() const { return conditions; };
34  gd::InstructionsList& GetConditions() { return conditions; };
35 
36  const gd::InstructionsList& GetActions() const { return actions; };
37  gd::InstructionsList& GetActions() { return actions; };
38 
39  const gd::Expression& GetRepeatExpression() const {
40  return repeatNumberExpression;
41  };
42  void SetRepeatExpressionPlainString(gd::String repeatNumberExpression_) {
43  repeatNumberExpression = gd::Expression(repeatNumberExpression_);
44  };
45 
46  virtual std::vector<gd::InstructionsList*> GetAllConditionsVectors();
47  virtual std::vector<gd::InstructionsList*> GetAllActionsVectors();
48  virtual std::vector<std::pair<gd::Expression*, gd::ParameterMetadata> >
49  GetAllExpressionsWithMetadata();
50 
51  virtual std::vector<const gd::InstructionsList*> GetAllConditionsVectors()
52  const;
53  virtual std::vector<const gd::InstructionsList*> GetAllActionsVectors() const;
54  virtual std::vector<std::pair<const gd::Expression*, const gd::ParameterMetadata> >
55  GetAllExpressionsWithMetadata() const;
56 
57  virtual void SerializeTo(SerializerElement& element) const;
58  virtual void UnserializeFrom(gd::Project& project,
59  const SerializerElement& element);
60 
61  private:
62  gd::Expression repeatNumberExpression;
63  gd::InstructionsList conditions;
64  gd::InstructionsList actions;
65  EventsList events;
66 
67  bool repeatNumberExpressionSelected;
68 };
69 
70 } // namespace gd
Base class defining an event.
Definition: Event.h:43
A list of events.
Definition: EventsList.h:32
Class representing an expression used as a parameter of a gd::Instruction. This class is nothing more...
Definition: Expression.h:30
Definition: InstructionsList.h:25
Base class representing a project (game), including all resources, scenes, objects,...
Definition: Project.h:51
Event being repeated a specified number of times.
Definition: RepeatEvent.h:21
virtual gd::EventsList & GetSubEvents()
Definition: RepeatEvent.h:31
virtual bool CanHaveSubEvents() const
Definition: RepeatEvent.h:29
virtual const gd::EventsList & GetSubEvents() const
Definition: RepeatEvent.h:30
virtual gd::RepeatEvent * Clone() const
Definition: RepeatEvent.h:25
virtual bool IsExecutable() const
Definition: RepeatEvent.h:27
String represents an UTF8 encoded string.
Definition: String.h:33
Definition: CommonTools.h:24