GDevelop Core
Core library for developing platforms and tools compatible with GDevelop.
ExternalEvents.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 #ifndef GDCORE_EXTERNALEVENTS_H
7 #define GDCORE_EXTERNALEVENTS_H
8 #include <ctime>
9 #include <memory>
10 #include <vector>
11 
12 #include "GDCore/Events/EventsList.h"
13 #include "GDCore/String.h"
14 namespace gd {
15 class BaseEvent;
16 }
17 namespace gd {
18 class Project;
19 }
20 namespace gd {
21 class SerializerElement;
22 }
23 
24 namespace gd {
25 
31 class GD_CORE_API ExternalEvents {
32  public:
35  virtual ~ExternalEvents(){};
36  ExternalEvents& operator=(const ExternalEvents& rhs);
37 
41  ExternalEvents* Clone() const { return new ExternalEvents(*this); };
42 
46  virtual const gd::String& GetName() const { return name; };
47 
51  virtual void SetName(const gd::String& name_) { name = name_; };
52 
59  virtual const gd::String& GetAssociatedLayout() const {
60  return associatedScene;
61  };
62 
66  virtual void SetAssociatedLayout(const gd::String& name_) {
67  associatedScene = name_;
68  };
69 
73  virtual const gd::EventsList& GetEvents() const { return events; }
74 
78  virtual gd::EventsList& GetEvents() { return events; }
79 
83  virtual void SerializeTo(SerializerElement& element) const;
84 
88  virtual void UnserializeFrom(gd::Project& project,
89  const SerializerElement& element);
90 
91  private:
92  gd::String name;
93  gd::String associatedScene;
94  gd::EventsList events;
95 
100  void Init(const ExternalEvents& externalEvents);
101 };
102 
103 } // namespace gd
104 
105 #endif // GDCORE_EXTERNALEVENTS_H
A list of events.
Definition: EventsList.h:32
Contains a list of events not directly linked to a layout.
Definition: ExternalEvents.h:31
virtual gd::EventsList & GetEvents()
Get the events.
Definition: ExternalEvents.h:78
virtual const gd::EventsList & GetEvents() const
Get the events.
Definition: ExternalEvents.h:73
virtual void SetName(const gd::String &name_)
Change external events name.
Definition: ExternalEvents.h:51
virtual const gd::String & GetAssociatedLayout() const
Get the layout associated with external events.
Definition: ExternalEvents.h:59
ExternalEvents * Clone() const
Return a pointer to a new ExternalEvents constructed from this one.
Definition: ExternalEvents.h:41
virtual void SetAssociatedLayout(const gd::String &name_)
Set the layout associated with external events.
Definition: ExternalEvents.h:66
virtual const gd::String & GetName() const
Get external events name.
Definition: ExternalEvents.h:46
Base class representing a project (game), including all resources, scenes, objects,...
Definition: Project.h:51
A generic container that can represent a value ( containing a string, double, bool or int),...
Definition: SerializerElement.h:37
String represents an UTF8 encoded string.
Definition: String.h:33
Definition: CommonTools.h:24