Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 9869 in orxonox.OLD for trunk/src/lib/graphics/render2D


Ignore:
Timestamp:
Oct 3, 2006, 12:19:30 AM (18 years ago)
Author:
bensch
Message:

orxonox/trunk: merged the new_class_id branche back to the trunk.
merged with command:
svn merge https://svn.orxonox.net/orxonox/branches/new_class_id trunk -r9683:HEAD
no conflicts… puh..

Location:
trunk/src/lib/graphics/render2D
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/lib/graphics/render2D/element_2d.cc

    r9406 r9869  
    2929#include "graphics_engine.h"
    3030#include "util/loading/load_param.h"
    31 #include "class_list.h"
    3231
    3332#include "color.h"
    34 
     33#include "debug.h"
    3534#include "shell_command.h"
     35
    3636SHELL_COMMAND(debug, Element2D, debug2D);
     37
     38ObjectListDefinition(Element2D);
    3739
    3840
     
    4648Element2D::Element2D (Element2D* parent, E2D_LAYER layer, short nodeFlags)
    4749{
    48   this->setClassID(CL_ELEMENT_2D, "Element2D");
     50  this->registerObject(this, Element2D::_objectList);
    4951
    5052  this->setVisibility(true);
     
    268270void Element2D::setBindNode(const std::string& bindNode)
    269271{
    270   const PNode* tmpBindNode = dynamic_cast<const PNode*>(ClassList::getObject(bindNode, CL_PARENT_NODE));
     272  const PNode* tmpBindNode = PNode::objectList().getObject(bindNode);
    271273  if (tmpBindNode != NULL)
    272274    this->bindNode = tmpBindNode;
     
    640642void Element2D::addChild2D (const std::string& childName)
    641643{
    642   Element2D* childNode = dynamic_cast<Element2D*>(ClassList::getObject(childName, CL_ELEMENT_2D));
     644  Element2D* childNode = Element2D::objectList().getObject(childName);
    643645  if (childNode != NULL)
    644646    this->addChild2D(childNode);
     
    718720void Element2D::setParent2D (const std::string& parentName)
    719721{
    720   Element2D* parentNode = dynamic_cast<Element2D*>(ClassList::getObject(parentName, CL_ELEMENT_2D));
     722  Element2D* parentNode = Element2D::objectList().getObject(parentName);
    721723  if (parentNode != NULL)
    722724    parentNode->addChild2D(this);
     
    771773void Element2D::setParentSoft2D(const std::string& parentName, float bias)
    772774{
    773   Element2D* parentNode = dynamic_cast<Element2D*>(ClassList::getObject(parentName, CL_ELEMENT_2D));
     775  Element2D* parentNode = Element2D::objectList().getObject(parentName);
    774776  if (parentNode != NULL)
    775777    this->setParentSoft2D(parentNode, bias);
  • trunk/src/lib/graphics/render2D/element_2d.h

    r8360 r9869  
    4747
    4848  E2D_PARENT_MOVEMENT                = 0x0004,    //!< Moves all children along with the parent.
    49 // special linkage modes
     49  // special linkage modes
    5050  E2D_PARENT_ALL                     = 0x0003,    //!< Moves all children around the center of their parent, and also rotates their centers
    5151  E2D_PARENT_ROTATE_AND_MOVE         = 0x0005,    //!< Rotates all children around their axis, and moves them as the Parent Moves, but does not rotate around the center of their parent.
     
    5858  E2D_REPARENT_DELETE_CHILDREN       = 0x0040,    //!< Deletes the Children of the node when This Node is Removed. (Use with care).
    5959  /// FIXME
    60    E2D_REPARENT_KEEP_POSITION         = 0x0080,   //!< Tries to keep the Position if the Node is reparented.
     60  E2D_REPARENT_KEEP_POSITION         = 0x0080,   //!< Tries to keep the Position if the Node is reparented.
    6161
    6262
     
    8787 * -> the tree is sorted on insertion of a new Child: @see Element2D::addChild2D()
    8888 */
    89 class Element2D : virtual public BaseObject {
    90 
    91   public:
    92     Element2D(Element2D* parent = Element2D::getNullElement(), E2D_LAYER layer = E2D_DEFAULT_LAYER, short nodeFlags = E2D_PARENT_MODE_DEFAULT);
    93     virtual ~Element2D();
    94 
    95     virtual void loadParams(const TiXmlElement* root);
    96 
    97     // ACTIVATION //
    98     inline void activate2D() { this->bActive = this->bRelCoorChanged = this->bRelDirChanged = true; };
    99     inline void deactivate2D() { this->bActive = false; };
    100     inline bool get2DActiveState() { return this->bActive; };
    101 
    102     // ALIGNMENT //
    103     /** @param alignment the new Alignment of the 2D-Element */
    104     inline void setAlignment(E2D_ALIGNMENT alignment) { this->alignment = alignment; };
    105     void setAlignment(const std::string& alignment);
    106     inline E2D_ALIGNMENT getAlignment() const { return this->alignment; };
    107 
    108     // LAYERING //
    109     void setLayer(E2D_LAYER layer);
    110     void setLayer(const std::string& layer);
    111     /** @returns the Layer this Element is drawn to */
    112     inline E2D_LAYER getLayer() const { return this->layer; };
    113 
    114     // VISIBILITY //
    115     /** @param visible true if the Element should be visible false otherwise (will not be rendered) */
    116     inline void setVisibility(bool visible) { this->bVisible = visible; };
    117     /** @returns the visibility state */
    118     inline bool isVisible() const { return (this->bVisible && this->bCurrentlyVisible);  };
    119 
    120 
    121     // POSITIONAL (E2D-specials) //
    122     /** @param bindNode the Node this 2D-element should follow. if NULL the Element will not follow anything */
    123     void setBindNode(const PNode* bindNode);
    124     void setBindNode(const std::string& bindNode);
    125     inline const PNode* getBindNode() const { return this->bindNode; };
    126 
    127     inline void setSize2D(float x, float y) { this->size = Vector2D(x, y); };
    128     inline void setSize2D(const Vector2D& size) { this->size = size; };
    129     inline const Vector2D& getSize2D() const { return this->size; };
    130     void setSizeSoft2D(float x, float y, float bias = 1.0);
    131     inline void setSizeX2D(float x) { this->size.x = x; };
    132     inline void setSizeY2D(float y) { this->size.y = y; };
    133     inline float getSizeX2D() const { return this->size.x; };
    134     inline float getSizeY2D() const { return this->size.y; };
    135 
    136   public:
    137     virtual void tick(float dt) {};
    138     virtual void draw() const  {};
    139     void tick2D(float dt);
    140     void draw2D(E2D_LAYER from, E2D_LAYER to) const;
    141     void drawChildren(E2D_LAYER from, E2D_LAYER to) const;
    142 
    143     // LIKE PNODE
    144   public:
    145     void setRelCoor2D (const Vector2D& relCoord);
    146     void setRelCoorX2D(float x);
    147     void setRelCoorY2D(float y);
    148     void setRelCoor2D (float x, float y);
    149     void setRelCoor2Dpx (int x, int y);
    150     void setRelCoorSoft2D (const Vector2D& relCoordSoft, float bias = 1.0);
    151     void setRelCoorSoft2D (float x, float y, float bias = 1.0);
    152     void setRelCoorSoft2Dpx (int x, int y, float bias = 1.0);
    153     /** @returns the relative position */
    154     inline const Vector2D& getRelCoor2D () const { return this->prevRelCoordinate; };
    155     /** @returns the Relative Coordinate Destination */
    156     inline const Vector2D& getRelCoorSoft2D() const { return (this->toCoordinate)?*this->toCoordinate:this->relCoordinate; };
    157     const Vector2D& getRelCoor2Dpx() const;
    158     void setAbsCoor2D (const Vector2D& absCoord);
    159     void setAbsCoor2D (float x, float y);
    160     void setAbsCoorX2D(float x);
    161     void setAbsCoorY2D(float y);
    162     void setAbsCoor2Dpx (int x, int y);
    163     void setAbsCoorSoft2D (const Vector2D& absCoordSoft, float bias = 1.0);
    164     void setAbsCoorSoft2D (float x, float y, float bias = 1.0);
    165     /** @returns the absolute position */
    166     inline const Vector2D& getAbsCoor2D () const { return this->absCoordinate; };
    167     const Vector2D& getAbsCoor2Dpx () const;
    168 
    169     void shiftCoor2D (const Vector2D& shift);
    170     void shiftCoor2Dpx (int x, int y);
    171 
    172     void setRelDir2D (float relDir);
    173     void setRelDirSoft2D(float relDirSoft, float bias = 1.0);
    174     /** @returns the relative Direction */
    175     inline float getRelDir2D () const { return this->prevRelDirection; };
    176     /** @returns the Relative Directional Destination */
    177     inline float getRelDirSoft2D() const { return (this->toDirection)?*this->toDirection:this->relDirection; };
    178     void setAbsDir2D (float absDir);
    179     void setAbsDirSoft2D (float absDirSoft, float bias = 1.0);
    180     /** @returns the absolute Direction */
    181     inline float getAbsDir2D () const { return this->absDirection; };
    182     void shiftDir2D (float shiftDir);
    183 
    184     /** @returns the Speed of the Node */
    185     inline float getSpeed() const { return 0; };
    186     /** @returns the Velocity of the Node */
    187     inline const Vector2D& getVelocity() const { return this->velocity; };
    188 
    189 
    190     void addChild2D (Element2D* child);
    191     void addChild2D (const std::string& childName);
    192     void removeChild2D (Element2D* child);
    193     void remove2D();
    194 
    195     /** @param parent the new parent of this Element2D */
    196     void setParent2D (Element2D* parent) { parent->addChild2D(this); };
    197     void setParent2D (const std::string& parentName);
    198     /** @returns the parent of this Element2D */
    199     inline Element2D* getParent2D () const { return this->parent; };
    200     /** @returns the List of Children of this Element2D */
    201     inline const std::list<Element2D*>& getChildren2D() const { return this->children; };
    202 
    203     void setParentSoft2D(Element2D* parentNode, float bias = 1.0);
    204     void setParentSoft2D(const std::string& parentName, float bias = 1.0);
    205 
    206     void setParentMode2D (E2D_PARENT_MODE parentMode);
    207     void setParentMode2D (const std::string& parentingMode);
    208     /** @returns the Parenting mode of this node */
    209     int getParentMode2D() const { return this->parentMode; };
    210 
    211     // NULL_PARENT //
    212     /** @returns the NullParent, the (main) ROOT of the PNode Tree. If it does not yet exist, it will be created. */
    213     static Element2D* getNullElement()  { return (Element2D::nullElement != NULL)? Element2D::nullElement : Element2D::createNullElement(); };
    214 
    215 
    216     void update2D (float dt);
    217 
    218     void debug2D (unsigned int depth = 1, unsigned int level = 0) const;
    219     void debugDraw2D(unsigned int depth = 1, float size = 1.0, Vector color = Vector(1,0,0), unsigned int level = 0) const;
    220 
    221     // helper functions //
    222     static const char* parentingModeToString2D(int parentingMode);
    223     static E2D_PARENT_MODE stringToParentingMode2D(const std::string& parentingMode);
    224 
    225     static const char* layer2DToChar(E2D_LAYER layer);
    226     static E2D_LAYER charToLayer2D(const std::string& layer);
    227 
    228     static bool layerSortPredicate(const Element2D* elem1, const Element2D* elem2);
    229 
    230   private:
    231     void eraseChild2D(Element2D* child);
    232     /** tells the child that the parent's Coordinate has changed */
    233     inline void parentCoorChanged2D () { this->bRelCoorChanged = true; }
    234     /** tells the child that the parent's Direction has changed */
    235     inline void parentDirChanged2D () { this->bRelDirChanged = true; }
    236     /** @returns the last calculated coordinate */
    237     inline Vector2D getLastAbsCoor2D() { return this->lastAbsCoordinate; }
    238 
    239     void reparent2D();
    240     static Element2D* createNullElement();
    241     bool checkIntegrity(const Element2D* checkParent) const;
    242 
    243 
    244   private:
    245     const PNode*            bindNode;           //!< a node over which to display this 2D-element
    246     Vector2D                size;               //!< The size of the rendered item
    247     Vector2D*               toSize;             //!< The Size to iterate to.
    248 
    249     E2D_ALIGNMENT           alignment;          //!< How the Element is aligned around its Position
    250 
    251     bool                    bVisible;           //!< If the given Element2D is visible.
    252     bool                    bCurrentlyVisible;  //!< Evaluated in the TICK process, to see if the Element is Currently visible.
    253     bool                    bActive;            //!< If the given Element2D is active.
    254     E2D_LAYER               layer;              //!< What layer this Element2D is on.
    255 
    256     bool                    bRelCoorChanged;    //!< If Relative Coordinate has changed since last time we checked
    257     bool                    bRelDirChanged;     //!< If Relative Direction has changed since last time we checked
    258 
    259     Vector2D                relCoordinate;      //!< coordinates relative to the parent
    260     Vector2D                absCoordinate;      //!< absolute coordinates in the world ( from (0,0,0) )
    261     float                   relDirection;       //!< direction relative to the parent
    262     float                   absDirection;       //!< absolute diretion in the world ( from (0,0,1) )
    263 
    264     Vector2D                prevRelCoordinate;  //!< The last Relative Coordinate from the last update-Cycle.
    265     Vector2D                lastAbsCoordinate;  //!< this is used for speedcalculation, it stores the last coordinate
    266     float                   prevRelDirection;   //!< The last Relative Direciton from the last update-Cycle.
    267 
    268     Vector2D                velocity;           //!< Saves the velocity.
    269 
    270     Vector2D*               toCoordinate;       //!< a position to which to iterate. (This is used in conjunction with setParentSoft.and set*CoorSoft)
    271     float*                  toDirection;        //!< a direction to which to iterate. (This is used in conjunction with setParentSoft and set*DirSoft)
    272     float                   bias;               //!< how fast to iterate to the given position (default is 1)
    273 
    274     Element2D*              parent;             //!< a pointer to the parent node
    275     std::list<Element2D*>   children;           //!< list of the children of this Element2D
    276 
    277     unsigned int            parentMode;         //!< the mode of the binding
    278 
    279     static Element2D*       nullElement;        //!< The top-most Element
     89class Element2D : virtual public BaseObject
     90{
     91  ObjectListDeclaration(Element2D);
     92
     93public:
     94  Element2D(Element2D* parent = Element2D::getNullElement(), E2D_LAYER layer = E2D_DEFAULT_LAYER, short nodeFlags = E2D_PARENT_MODE_DEFAULT);
     95  virtual ~Element2D();
     96
     97  virtual void loadParams(const TiXmlElement* root);
     98
     99  // ACTIVATION //
     100  inline void activate2D() { this->bActive = this->bRelCoorChanged = this->bRelDirChanged = true; };
     101  inline void deactivate2D() { this->bActive = false; };
     102  inline bool get2DActiveState() { return this->bActive; };
     103
     104  // ALIGNMENT //
     105  /** @param alignment the new Alignment of the 2D-Element */
     106  inline void setAlignment(E2D_ALIGNMENT alignment) { this->alignment = alignment; };
     107  void setAlignment(const std::string& alignment);
     108  inline E2D_ALIGNMENT getAlignment() const { return this->alignment; };
     109
     110  // LAYERING //
     111  void setLayer(E2D_LAYER layer);
     112  void setLayer(const std::string& layer);
     113  /** @returns the Layer this Element is drawn to */
     114  inline E2D_LAYER getLayer() const { return this->layer; };
     115
     116  // VISIBILITY //
     117  /** @param visible true if the Element should be visible false otherwise (will not be rendered) */
     118  inline void setVisibility(bool visible) { this->bVisible = visible; };
     119  /** @returns the visibility state */
     120  inline bool isVisible() const { return (this->bVisible && this->bCurrentlyVisible);  };
     121
     122
     123  // POSITIONAL (E2D-specials) //
     124  /** @param bindNode the Node this 2D-element should follow. if NULL the Element will not follow anything */
     125  void setBindNode(const PNode* bindNode);
     126  void setBindNode(const std::string& bindNode);
     127  inline const PNode* getBindNode() const { return this->bindNode; };
     128
     129  inline void setSize2D(float x, float y) { this->size = Vector2D(x, y); };
     130  inline void setSize2D(const Vector2D& size) { this->size = size; };
     131  inline const Vector2D& getSize2D() const { return this->size; };
     132  void setSizeSoft2D(float x, float y, float bias = 1.0);
     133  inline void setSizeX2D(float x) { this->size.x = x; };
     134  inline void setSizeY2D(float y) { this->size.y = y; };
     135  inline float getSizeX2D() const { return this->size.x; };
     136  inline float getSizeY2D() const { return this->size.y; };
     137
     138public:
     139  virtual void tick(float dt) {};
     140  virtual void draw() const  {};
     141  void tick2D(float dt);
     142  void draw2D(E2D_LAYER from, E2D_LAYER to) const;
     143  void drawChildren(E2D_LAYER from, E2D_LAYER to) const;
     144
     145  // LIKE PNODE
     146public:
     147  void setRelCoor2D (const Vector2D& relCoord);
     148  void setRelCoorX2D(float x);
     149  void setRelCoorY2D(float y);
     150  void setRelCoor2D (float x, float y);
     151  void setRelCoor2Dpx (int x, int y);
     152  void setRelCoorSoft2D (const Vector2D& relCoordSoft, float bias = 1.0);
     153  void setRelCoorSoft2D (float x, float y, float bias = 1.0);
     154  void setRelCoorSoft2Dpx (int x, int y, float bias = 1.0);
     155  /** @returns the relative position */
     156  inline const Vector2D& getRelCoor2D () const { return this->prevRelCoordinate; };
     157  /** @returns the Relative Coordinate Destination */
     158inline const Vector2D& getRelCoorSoft2D() const { return (this->toCoordinate)?*this->toCoordinate:this->relCoordinate; };
     159  const Vector2D& getRelCoor2Dpx() const;
     160  void setAbsCoor2D (const Vector2D& absCoord);
     161  void setAbsCoor2D (float x, float y);
     162  void setAbsCoorX2D(float x);
     163  void setAbsCoorY2D(float y);
     164  void setAbsCoor2Dpx (int x, int y);
     165  void setAbsCoorSoft2D (const Vector2D& absCoordSoft, float bias = 1.0);
     166  void setAbsCoorSoft2D (float x, float y, float bias = 1.0);
     167  /** @returns the absolute position */
     168  inline const Vector2D& getAbsCoor2D () const { return this->absCoordinate; };
     169  const Vector2D& getAbsCoor2Dpx () const;
     170
     171  void shiftCoor2D (const Vector2D& shift);
     172  void shiftCoor2Dpx (int x, int y);
     173
     174  void setRelDir2D (float relDir);
     175  void setRelDirSoft2D(float relDirSoft, float bias = 1.0);
     176  /** @returns the relative Direction */
     177  inline float getRelDir2D () const { return this->prevRelDirection; };
     178  /** @returns the Relative Directional Destination */
     179inline float getRelDirSoft2D() const { return (this->toDirection)?*this->toDirection:this->relDirection; };
     180  void setAbsDir2D (float absDir);
     181  void setAbsDirSoft2D (float absDirSoft, float bias = 1.0);
     182  /** @returns the absolute Direction */
     183  inline float getAbsDir2D () const { return this->absDirection; };
     184  void shiftDir2D (float shiftDir);
     185
     186  /** @returns the Speed of the Node */
     187  inline float getSpeed() const { return 0; };
     188  /** @returns the Velocity of the Node */
     189  inline const Vector2D& getVelocity() const { return this->velocity; };
     190
     191
     192  void addChild2D (Element2D* child);
     193  void addChild2D (const std::string& childName);
     194  void removeChild2D (Element2D* child);
     195  void remove2D();
     196
     197  /** @param parent the new parent of this Element2D */
     198  void setParent2D (Element2D* parent) { parent->addChild2D(this); };
     199  void setParent2D (const std::string& parentName);
     200  /** @returns the parent of this Element2D */
     201  inline Element2D* getParent2D () const { return this->parent; };
     202  /** @returns the List of Children of this Element2D */
     203  inline const std::list<Element2D*>& getChildren2D() const { return this->children; };
     204
     205  void setParentSoft2D(Element2D* parentNode, float bias = 1.0);
     206  void setParentSoft2D(const std::string& parentName, float bias = 1.0);
     207
     208  void setParentMode2D (E2D_PARENT_MODE parentMode);
     209  void setParentMode2D (const std::string& parentingMode);
     210  /** @returns the Parenting mode of this node */
     211  int getParentMode2D() const { return this->parentMode; };
     212
     213  // NULL_PARENT //
     214  /** @returns the NullParent, the (main) ROOT of the PNode Tree. If it does not yet exist, it will be created. */
     215static Element2D* getNullElement()  { return (Element2D::nullElement != NULL)? Element2D::nullElement : Element2D::createNullElement(); };
     216
     217
     218  void update2D (float dt);
     219
     220  void debug2D (unsigned int depth = 1, unsigned int level = 0) const;
     221  void debugDraw2D(unsigned int depth = 1, float size = 1.0, Vector color = Vector(1,0,0), unsigned int level = 0) const;
     222
     223  // helper functions //
     224  static const char* parentingModeToString2D(int parentingMode);
     225  static E2D_PARENT_MODE stringToParentingMode2D(const std::string& parentingMode);
     226
     227  static const char* layer2DToChar(E2D_LAYER layer);
     228  static E2D_LAYER charToLayer2D(const std::string& layer);
     229
     230  static bool layerSortPredicate(const Element2D* elem1, const Element2D* elem2);
     231
     232private:
     233  void eraseChild2D(Element2D* child);
     234  /** tells the child that the parent's Coordinate has changed */
     235  inline void parentCoorChanged2D () { this->bRelCoorChanged = true; }
     236  /** tells the child that the parent's Direction has changed */
     237  inline void parentDirChanged2D () { this->bRelDirChanged = true; }
     238  /** @returns the last calculated coordinate */
     239  inline Vector2D getLastAbsCoor2D() { return this->lastAbsCoordinate; }
     240
     241  void reparent2D();
     242  static Element2D* createNullElement();
     243  bool checkIntegrity(const Element2D* checkParent) const;
     244
     245
     246private:
     247  const PNode*            bindNode;           //!< a node over which to display this 2D-element
     248  Vector2D                size;               //!< The size of the rendered item
     249  Vector2D*               toSize;             //!< The Size to iterate to.
     250
     251  E2D_ALIGNMENT           alignment;          //!< How the Element is aligned around its Position
     252
     253  bool                    bVisible;           //!< If the given Element2D is visible.
     254  bool                    bCurrentlyVisible;  //!< Evaluated in the TICK process, to see if the Element is Currently visible.
     255  bool                    bActive;            //!< If the given Element2D is active.
     256  E2D_LAYER               layer;              //!< What layer this Element2D is on.
     257
     258  bool                    bRelCoorChanged;    //!< If Relative Coordinate has changed since last time we checked
     259  bool                    bRelDirChanged;     //!< If Relative Direction has changed since last time we checked
     260
     261  Vector2D                relCoordinate;      //!< coordinates relative to the parent
     262  Vector2D                absCoordinate;      //!< absolute coordinates in the world ( from (0,0,0) )
     263  float                   relDirection;       //!< direction relative to the parent
     264  float                   absDirection;       //!< absolute diretion in the world ( from (0,0,1) )
     265
     266  Vector2D                prevRelCoordinate;  //!< The last Relative Coordinate from the last update-Cycle.
     267  Vector2D                lastAbsCoordinate;  //!< this is used for speedcalculation, it stores the last coordinate
     268  float                   prevRelDirection;   //!< The last Relative Direciton from the last update-Cycle.
     269
     270  Vector2D                velocity;           //!< Saves the velocity.
     271
     272  Vector2D*               toCoordinate;       //!< a position to which to iterate. (This is used in conjunction with setParentSoft.and set*CoorSoft)
     273  float*                  toDirection;        //!< a direction to which to iterate. (This is used in conjunction with setParentSoft and set*DirSoft)
     274  float                   bias;               //!< how fast to iterate to the given position (default is 1)
     275
     276  Element2D*              parent;             //!< a pointer to the parent node
     277  std::list<Element2D*>   children;           //!< list of the children of this Element2D
     278
     279  unsigned int            parentMode;         //!< the mode of the binding
     280
     281  static Element2D*       nullElement;        //!< The top-most Element
    280282};
    281283
  • trunk/src/lib/graphics/render2D/image_plane.cc

    r9406 r9869  
    2121
    2222#include "graphics_engine.h"
    23 #include "glincl.h"
    2423#include "p_node.h"
    2524
    2625
     26#include "class_id_DEPRECATED.h"
    2727
    28 
    29 
    30 CREATE_FACTORY(ImagePlane, CL_IMAGE_ENTITY);
     28ObjectListDefinitionID(ImagePlane, CL_IMAGE_PLANE);
     29CREATE_FACTORY(ImagePlane);
    3130
    3231
     
    5655void ImagePlane::init()
    5756{
    58   this->setClassID(CL_IMAGE_PLANE, "ImagePlane");
     57  this->registerObject(this, ImagePlane::_objectList);
    5958  this->setName("ImagePlane");
    6059
  • trunk/src/lib/graphics/render2D/image_plane.h

    r7843 r9869  
    1717class ImagePlane :  public Element2D
    1818{
    19 
     19  ObjectListDeclaration(ImagePlane);
    2020  public:
    2121    ImagePlane(const TiXmlElement* root = NULL);
  • trunk/src/lib/graphics/render2D/render_2d.cc

    r9406 r9869  
    1919
    2020#include "graphics_engine.h"
    21 #include "class_list.h"
    2221#include "element_2d.h"
    2322
     23ObjectListDefinition(Render2D);
    2424
    2525
     
    2929Render2D::Render2D ()
    3030{
    31    this->setClassID(CL_RENDER_2D, "Render2D");
    32    this->setName("Render2D");
     31  this->registerObject(this, Render2D::_objectList);
     32  this->setName("Render2D");
    3333
    34    this->showNodes = false;
     34  this->showNodes = false;
    3535}
    3636
  • trunk/src/lib/graphics/render2D/render_2d.h

    r7840 r9869  
    1212
    1313//! A default singleton class.
    14 class Render2D : public BaseObject {
     14class Render2D : public BaseObject
     15{
     16  ObjectListDeclaration(Render2D);
     17
    1518  friend class Element2D;
    1619
    17   public:
    18     virtual ~Render2D();
    19     /** @returns a Pointer to the only object of this Class */
    20     inline static Render2D* getInstance() { if (!singletonRef) singletonRef = new Render2D();  return singletonRef; };
     20public:
     21  virtual ~Render2D();
     22  /** @returns a Pointer to the only object of this Class */
     23  inline static Render2D* getInstance() { if (!singletonRef) singletonRef = new Render2D();  return singletonRef; };
    2124
    22     void toggleNodesVisibility() { this->showNodes = !this->showNodes; };
     25void toggleNodesVisibility() { this->showNodes = !this->showNodes; };
    2326
    24     void update(float dt);
    25     void tick(float dt);
    26     void draw(E2D_LAYER from, E2D_LAYER to) const;
     27  void update(float dt);
     28  void tick(float dt);
     29  void draw(E2D_LAYER from, E2D_LAYER to) const;
    2730
    28   private:
    29     Render2D();
    30     static Render2D*              singletonRef;                    //!< Reference to this class.
     31private:
     32  Render2D();
     33  static Render2D*              singletonRef;                    //!< Reference to this class.
    3134
    32     bool                          showNodes;                       //!< If the debug-Nodes should be visible
    33  };
     35  bool                          showNodes;                       //!< If the debug-Nodes should be visible
     36};
    3437
    3538#endif /* _RENDER_2D_H */
Note: See TracChangeset for help on using the changeset viewer.