mkRPG
src/editor/Game/object.h
Go to the documentation of this file.
00001 #ifndef OBJECT_H
00002 #define OBJECT_H
00003 
00004 #include "typedobject.hxx"
00005 
00006 
00007 
00022 class Image : public GameObject
00023 {
00024 public:
00025     TypeName(Image)
00026     Image(GameObject &parent, const QString &fileName);
00027     inline bool isValid() const{return GameObject::isValid() && !im.isNull();} 
00030     inline const QImage& image() const{return im;}
00031     inline const QSize size() const{return im.size();}
00032     void update(){} // TODO
00033 private:
00034     QImage im;
00035 };
00036 
00037 
00038 
00039 
00040 class ObjectType; 
00044 class ObjectType : public Type<ObjectType>
00045 {
00046 public:
00047     TypeName(ObjectType)
00048     ObjectType(ObjectType &ancestor);
00049     ObjectType(DefaultTypes &parent);
00050 
00051 
00052     inline Image* image() const{return aImage ? aImage : aTypedAncestor ? aTypedAncestor->image() : nullptr;}
00053     inline void setImage(Image* im){aImage = im; touch();}
00054 
00055 
00056 private:
00057     Image * aImage;
00058 };
00059 
00063 class Object : public TypedObject<ObjectType>
00064 {
00065 public:
00066     TypeName(Object)
00067     Object(ObjectType &type, GameObject &parent);
00068 
00069     ObjectType &objectType(){return *aObjectType;}
00070 
00071     C0(Flag, v,V,isible)
00072     C0(Flag, m,M,ovable)
00073     C0(Flag, i,I,nteractive)
00074     C0(AttrT,i,I,mage)
00075 
00076 };
00077 
00078 
00079 
00080 
00081 #endif // OBJECT_H
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Properties Defines