Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 4850 in orxonox.OLD


Ignore:
Timestamp:
Jul 13, 2005, 7:23:20 PM (19 years ago)
Author:
bensch
Message:

orxonox/trunk: Text is now too a Element2D, and it does not need the TextEngine anymore to draw it.
optimizing…

Location:
orxonox/trunk/src
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • orxonox/trunk/src/lib/graphics/graphics_engine.cc

    r4849 r4850  
    2121
    2222#include "render_2d.h"
     23#include "light.h"
    2324#include "debug.h"
    2425#include "text_engine.h"
     
    433434{
    434435  Render2D::getInstance()->draw();
    435 
     436  LightManager::getInstance()->draw();
    436437}
    437438
  • orxonox/trunk/src/lib/graphics/render2D/element_2d.h

    r4849 r4850  
    4545class Element2D : virtual public BaseObject {
    4646
    47  public:
    48   Element2D();
    49   virtual ~Element2D();
     47  public:
     48    Element2D();
     49    virtual ~Element2D();
    5050
    51   void setPosition(int xCoord, int yCoord);
    52   void setLayer(E2DLayer layer);
    53   /** @param visible true if the Element should be visible false otherwise (will not be rendered) */
    54   inline void setVisibility(bool visible) { this->visible = visible; };
    55   /** @param bindNode the Node this 2D-element should follow. if NULL the Element will not follow anything */
    56   inline void setBindNode(const PNode* bindNode) { this->bindNode = bindNode; };
     51    void setPosition2D(int xCoord, int yCoord);
     52    void setLayer(E2DLayer layer);
     53    /** @param visible true if the Element should be visible false otherwise (will not be rendered) */
     54    inline void setVisibility(bool visible) { this->visible = visible; };
     55    /** @param bindNode the Node this 2D-element should follow. if NULL the Element will not follow anything */
     56 // inline void setBindNode(const PNode* bindNode) { this->bindNode = bindNode; };
    5757
    58   /** @returns the visibility state */
    59   inline bool isVisible() { return this->visible; };
     58    /** @returns the visibility state */
     59    inline bool isVisible() { return this->visible; };
    6060
    61   void positioning();
    62   virtual void tick(float dt);
    63   virtual void draw() const = NULL;
     61    void positioning();
     62    virtual void tick(float dt);
     63    virtual void draw() const = NULL;
    6464
    6565  private:
    6666    void init();
    6767
    68  private:
    69    bool                    visible;
    70    int                     relPos2D[2];      //!< X-coord, Y-Coord (relative to the Coordinates of the alignment if given.)
    71    Position2D              absPos2D;         //!< The absolute position of the 2D-Element.
    72    E2DLayer                layer;
     68  protected:
     69    const PNode*            bindNode;         //!< a node over which to display this 2D-element
     70  private:
     71    bool                    visible;
     72    int                     relPos2D[2];      //!< X-coord, Y-Coord (relative to the Coordinates of the alignment if given.)
     73    Position2D              absPos2D;         //!< The absolute position of the 2D-Element.
     74    E2DLayer                layer;
    7375
    74    E2D_ALIGNMENT           alignment;        //!< How the Element is aligned around its Position
    75    const PNode*            bindNode;         //!< a node over which to display this 2D-element
     76    E2D_ALIGNMENT           alignment;        //!< How the Element is aligned around its Position
    7677};
    7778
  • orxonox/trunk/src/lib/graphics/text_engine.cc

    r4836 r4850  
    7474{
    7575  TextEngine::getInstance()->deleteText(this);
    76 }
    77 
    78 /**
    79  *  tells the Text, that it should folow a PNode
    80  * @param bindNode: the node to bind this text to
    81 */
    82 void Text::setBindNode(PNode* bindNode)
    83 {
    84   this->bindNode = bindNode;
    8576}
    8677
     
    185176
    186177/**
    187  *  draws the Font
     178 *  draws the Text
    188179*/
    189180void Text::draw() const
     
    217208  // setting the Blending effects
    218209  glColor4f(1.0f,1.0f,1.0f, this->blending);
     210  glEnable(GL_BLEND);
     211  glEnable(GL_TEXTURE_2D);
    219212  glBlendFunc(GL_SRC_ALPHA, GL_ONE);
    220213
  • orxonox/trunk/src/lib/graphics/text_engine.h

    r4836 r4850  
    2626#endif
    2727
     28#include "base_object.h"
     29#include "element_2d.h"
     30
    2831#include "vector.h"
    29 #include "base_object.h"
    3032
    3133// FORWARD DECLARATION
     
    104106////////////
    105107//! Represents one textElement.
    106 class Text : public BaseObject
     108class Text : public Element2D
    107109{
    108110  friend class TextEngine;
    109111 public:
    110112  ~Text();
    111 
    112   void setBindNode(PNode* bindNode);
    113113
    114114  void setType(int type);
     
    124124  void createTexture();
    125125
    126   void draw() const;
     126  virtual void draw() const;
    127127
    128128  void debug() const;
     
    147147  TexCoord          texCoord;       //!< Texture-coordinates @todo fix this to have a struct
    148148  SDL_Rect          posSize;        //!< An SDL-Rectangle representing the position and size of the Text on the screen.
    149 
    150   PNode*            bindNode;       //!< A node the Text is bind to. (if NULL thr node will not be bound to anything.)
    151149};
    152150
  • orxonox/trunk/src/story_entities/world.cc

    r4849 r4850  
    850850
    851851  GraphicsEngine::getInstance()->draw();
    852   TextEngine::getInstance()->draw();
    853   LightManager::getInstance()->draw(); // must be at the end of the drawing procedure, otherwise Light cannot be handled as PNodes //
     852  //TextEngine::getInstance()->draw();
    854853}
    855854
Note: See TracChangeset for help on using the changeset viewer.