Game Develop Core: WhileEvent.h Source File

| Game Develop Core Core library for developing platforms and tools compatible with Game Develop.

- Main Page
- Modules
- Classes

- File List
- File Members

All Classes Files Functions Variables Typedefs Enumerations Macros Groups Pages
WhileEvent.h
Go to the documentation of this file.
1
6 #ifndef GDCORE_WHILEEVENT_H
7 #define GDCORE_WHILEEVENT_H
8 #include "GDCore/Events/Event.h"
9 namespace gd { class Instruction; }
10 namespace gd { class Project; }
11 class RuntimeScene;
12 class TiXmlElement;
13 namespace gd { class EventsEditorItemsAreas; }
14 namespace gd { class EventsEditorSelection; }
15
16 namespace gd
17 {
18
25 class GD_CORE_API WhileEvent : public gd::BaseEvent
26 {
27 public:
28 WhileEvent() : infiniteLoopWarning(true), justCreatedByTheUser(true) {};
29 WhileEvent(const WhileEvent & event);
30 virtual ~WhileEvent() {};
31
32 WhileEvent& operator=(const WhileEvent & event);
33 virtual gd::BaseEventSPtr Clone() const { return boost::shared_ptr<gd::BaseEvent>(new WhileEvent(*this));}
34
35 virtual bool IsExecutable() const {return true;}
36
37 virtual bool CanHaveSubEvents() const {return true;}
38 virtual const std::vector < gd::BaseEventSPtr > & GetSubEvents() const {return events;};
39 virtual std::vector < gd::BaseEventSPtr > & GetSubEvents() {return events;};
40 void SetSubEvents(std::vector < gd::BaseEventSPtr > & subEvents_) {events = subEvents_;};
41
42 const std::vector < gd::Instruction > & GetConditions() const { return conditions; };
43 std::vector < gd::Instruction > & GetConditions() { return conditions; };
44 void SetConditions(std::vector < gd::Instruction > & conditions_) { conditions = conditions_; };
45
46 const std::vector < gd::Instruction > & GetActions() const { return actions; };
47 std::vector < gd::Instruction > & GetActions() { return actions; };
48 void SetActions(std::vector < gd::Instruction > & actions_) { actions = actions_; };
49
50 const std::vector < gd::Instruction > & GetWhileConditions() const { return whileConditions; };
51 std::vector < gd::Instruction > & GetWhileConditions() { return whileConditions; };
52 void SetWhileConditions(std::vector < gd::Instruction > & whileConditions_) { whileConditions = whileConditions_; };
53
54 bool HasInfiniteLoopWarning() const { return infiniteLoopWarning; }
55
56 virtual std::vector < std::vector<gd::Instruction>* > GetAllConditionsVectors();
57 virtual std::vector < std::vector<gd::Instruction>* > GetAllActionsVectors();
58
59 virtual void SaveToXml(TiXmlElement * eventElem) const;
60 virtual void LoadFromXml(gd::Project & project, const TiXmlElement * eventElem);
61
65 virtual void Render(wxDC & dc, int x, int y, unsigned int width, gd::EventsEditorItemsAreas & areas, gd::EventsEditorSelection & selection, const gd::Platform & platform);
66
70 virtual unsigned int GetRenderedHeight(unsigned int width, const gd::Platform & platform) const;
71
75 virtual EditEventReturnType EditEvent(wxWindow* parent_, gd::Project & game_, gd::Layout & scene_, gd::MainFrameWrapper & mainFrameWrapper_);
76
77 private:
78 void Init(const WhileEvent & event);
79
80 std::vector < gd::Instruction > whileConditions;
81 std::vector < gd::Instruction > conditions;
82 std::vector < gd::Instruction > actions;
83 std::vector < gd::BaseEventSPtr > events;
84 bool infiniteLoopWarning;
85 bool justCreatedByTheUser;
86
87 mutable unsigned int whileConditionsHeight;
88
89 int GetConditionsHeight() const;
90 int GetActionsHeight() const;
91 int GetWhileConditionsHeight() const;
92 };
93
94 }
95
96 #endif // GDCORE_WHILEEVENT_H