00001
00002
00003
00004
00005
00006
00007
00008 #ifndef __SP_STORYBOARD_H__
00009 #define __SP_STORYBOARD_H__
00010
00011
00012 #include "Base/spStandard.hpp"
00013
00014 #ifdef SP_COMPILE_WITH_STORYBOARD
00015
00016
00017 #include "Framework/Tools/spStoryboardTrigger.hpp"
00018 #include "Framework/Tools/spStoryboardEvent.hpp"
00019 #include "Framework/Tools/spStoryboardLogicGate.hpp"
00020
00021 #include <list>
00022 #include <vector>
00023
00024
00025 namespace sp
00026 {
00027 namespace tool
00028 {
00029
00030
00031 class SP_EXPORT Storyboard
00032 {
00033
00034 public:
00035
00036 Storyboard();
00037 ~Storyboard();
00038
00039
00040
00042 void update();
00043
00044 void deleteTrigger(Trigger* Obj);
00045 void clearTriggers();
00046
00047 void deleteEvent(Event* Obj);
00048 void clearEvents();
00049
00050
00051
00052 template <typename T>
00053 T* createTrigger()
00054 {
00055 return addTrigger(new T());
00056 }
00057 template <typename T, typename Arg0>
00058 T* createTrigger(const Arg0 &arg0)
00059 {
00060 return addTrigger(new T(arg0));
00061 }
00062 template <typename T, typename Arg0, typename Arg1>
00063 T* createTrigger(const Arg0 &arg0, const Arg1 &arg1)
00064 {
00065 return addTrigger(new T(arg0, arg1));
00066 }
00067 template <typename T, typename Arg0, typename Arg1, typename Arg2>
00068 T* createTrigger(const Arg0 &arg0, const Arg1 &arg1, const Arg2 &arg2)
00069 {
00070 return addTrigger(new T(arg0, arg1, arg2));
00071 }
00072 template <typename T, typename Arg0, typename Arg1, typename Arg2, typename Arg3>
00073 T* createTrigger(const Arg0 &arg0, const Arg1 &arg1, const Arg2 &arg2, const Arg3 &arg3)
00074 {
00075 return addTrigger(new T(arg0, arg1, arg2, arg3));
00076 }
00077 template <typename T, typename Arg0, typename Arg1, typename Arg2, typename Arg3, typename Arg4>
00078 T* createTrigger(const Arg0 &arg0, const Arg1 &arg1, const Arg2 &arg2, const Arg3 &arg3, const Arg4 &arg4)
00079 {
00080 return addTrigger(new T(arg0, arg1, arg2, arg3, arg4));
00081 }
00082
00083 template <typename T>
00084 T* createEvent()
00085 {
00086 return addEvent(new T());
00087 }
00088 template <typename T, typename Arg0>
00089 T* createEvent(const Arg0 &arg0)
00090 {
00091 return addEvent(new T(arg0));
00092 }
00093 template <typename T, typename Arg0, typename Arg1>
00094 T* createEvent(const Arg0 &arg0, const Arg1 &arg1)
00095 {
00096 return addEvent(new T(arg0, arg1));
00097 }
00098 template <typename T, typename Arg0, typename Arg1, typename Arg2>
00099 T* createEvent(const Arg0 &arg0, const Arg1 &arg1, const Arg2 &arg2)
00100 {
00101 return addEvent(new T(arg0, arg1, arg2));
00102 }
00103 template <typename T, typename Arg0, typename Arg1, typename Arg2, typename Arg3>
00104 T* createEvent(const Arg0 &arg0, const Arg1 &arg1, const Arg2 &arg2, const Arg3 &arg3)
00105 {
00106 return addEvent(new T(arg0, arg1, arg2, arg3));
00107 }
00108 template <typename T, typename Arg0, typename Arg1, typename Arg2, typename Arg3, typename Arg4>
00109 T* createEvent(const Arg0 &arg0, const Arg1 &arg1, const Arg2 &arg2, const Arg3 &arg3, const Arg4 &arg4)
00110 {
00111 return addEvent(new T(arg0, arg1, arg2, arg3, arg4));
00112 }
00113
00114
00115
00116 static Storyboard* getActive();
00117 static void setActive(Storyboard* ActiveStoryboard);
00118
00119
00120
00121 inline const std::list<Trigger*>& getTriggerList() const
00122 {
00123 return Triggers_;
00124 }
00125 inline const std::vector<Trigger*>& getActiveTriggerList() const
00126 {
00127 return ActiveTriggers_;
00128 }
00129
00130 inline const std::vector<Event*>& getEventList() const
00131 {
00132 return Events_;
00133 }
00134
00135 private:
00136
00137 friend class Trigger;
00138
00139
00140
00141 void addLoopUpdate(Trigger* Obj);
00142 void removeLoopUpdate(Trigger* Obj);
00143
00144
00145
00146 template <typename T> T* addTrigger(T* NewTrigger)
00147 {
00148 Triggers_.push_back(NewTrigger);
00149 return NewTrigger;
00150 }
00151
00152 template <typename T> T* addEvent(T* NewEvent)
00153 {
00154 Events_.push_back(NewEvent);
00155 return NewEvent;
00156 }
00157
00158
00159
00160 std::list<Trigger*> Triggers_;
00161 std::vector<Trigger*> ActiveTriggers_;
00162 std::vector<Event*> Events_;
00163
00164 static Storyboard* Active_;
00165
00166 };
00167
00168
00169 }
00170
00171 }
00172
00173
00174 #endif
00175
00176 #endif
00177
00178
00179
00180