ObjectTrail.h

Go to the documentation of this file.
00001 
00011 #ifndef __OBJECTTRAIL__H__
00012 #define __OBJECTTRAIL__H__
00013 
00014 #include <wx/wx.h>
00015 #include <wx/colour.h>
00016 
00017 #include "../common.h"
00018 #include "../tinyxml/tinyxml.h"
00019 #include "Object.h"
00020 
00024 class ObjectTrail: public Object {
00025 public:
00029         typedef int DurationSize;
00030 
00034         static DurationSize GetDurationSizeMin() {
00035                 return DURATION_MIN;
00036         }
00037 
00041         static DurationSize GetDurationSizeMax() {
00042                 return DURATION_MAX;
00043         }
00044 
00045 public:
00049         class Config: public Object::Config {
00050         public:
00060                 Config(const string & imageFile, const Direction & objectDirection, const Action & objectAction,
00061                         const string & objectName, const string & objectDescription, ObjectTrail::DurationSize trailDuration):
00062                                 Object::Config(imageFile, objectDirection, objectAction, objectName, objectDescription),
00063                                 duration(trailDuration)
00064                 {}
00065 
00069                 explicit Config(TiXmlElement * node);
00070 
00074                 virtual ~Config() {}
00075 
00081                 virtual void ShowEditationWindow(wxWindow * parent, bool waitUntilClosed = true);
00082 
00086                 virtual TiXmlElement * CreateXmlNode() const;
00087 
00091                 virtual const string & GetObjectClassName() const {
00092                         return CLASS_NAME;
00093                 }
00094 
00098                 ObjectTrail::DurationSize GetDuration() const {
00099                         return duration;
00100                 }
00101 
00107                 virtual const wxColour * GetObjectTextColour() const {
00108                         return wxBLUE;
00109                 }
00110 
00111         private:
00113                 ObjectTrail::DurationSize duration;
00114         };
00115 
00116 public:
00121         ObjectTrail(const ObjectTrail::Config & config): Object(config), duration(config.GetDuration()) {}
00122 
00126         virtual ~ObjectTrail() {}
00127 
00132         virtual void Collision(Object * collisionObject) {}
00133 
00140         virtual Object::Config * CreateObjectConfig() const;
00141 
00151         virtual void LoadFromConfig(const Object::Config & config, bool fullLoad = true);
00152 
00159         virtual void SetAction(const Action & newAction) {}
00160 
00166         virtual void SetDirection(const Direction & newDirection) {
00167                 direction.SetDirection(newDirection.GetDirection());
00168         }
00169 
00173         virtual const Priority & GetPriority() const {
00174                 return ObjectTrail::PRIORITY;
00175         }
00176 
00181         virtual bool CanAppearMoreThenOnce() const {
00182                 return ObjectTrail::CAN_APPEAR_MORE_THEN_ONCE;
00183         }
00184 
00189         virtual const string & GetClassName() const {
00190                 return ObjectTrail::CLASS_NAME;
00191         }
00192 
00198         virtual void ChooseNextAction() {
00199                 duration--;
00200                 if (duration >= 0)
00201                         action.SetAction(Action::WAIT);
00202                 else
00203                         action.SetAction(Action::EXPIRED_REMOVE);
00204         }
00205 
00210         virtual bool IsImaginary() const {
00211                 return true;
00212         }
00213 
00217         virtual bool IsEditableByUser() const {
00218                 return false;
00219         }
00220 
00224         virtual bool IsMoveableByUser() const {
00225                 return false;
00226         }
00227 
00228 public:
00230         static const string CLASS_NAME;
00231 
00232 protected:
00236         ObjectTrail::DurationSize GetDuration() const {
00237                 return duration;
00238         }
00239 
00240 private:
00242         DurationSize duration;
00244         static const DurationSize DURATION_MIN;
00246         static const DurationSize DURATION_MAX;
00248         static const Object::Priority PRIORITY;
00250         static const bool CAN_APPEAR_MORE_THEN_ONCE;
00251 };
00252 
00253 #endif /* #ifndef __OBJECTTRAIL__H__ */
00254 
00255 /* End of file ObjectTrail.h */

Generated on Sun Apr 29 11:46:10 2007 for IPP/ICP2007 by  doxygen 1.4.7