Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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


Ignore:
Timestamp:
Mar 15, 2006, 3:10:45 PM (19 years ago)
Author:
bensch
Message:

orxonox/trunk: merged the std-branche back, it runs on windows and Linux

svn merge https://svn.orxonox.net/orxonox/branches/std . -r7202:HEAD

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

Legend:

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

    r7193 r7221  
    7878void Billboard::loadParams(const TiXmlElement* root)
    7979{
    80   LoadParam(root, "texture", this, Billboard, setTexture)
     80  LoadParam(root, "texture", this->material, Material, setDiffuseMap)
    8181      .describe("the texture-file to load onto the Billboard");
    8282
     
    100100 * @param textureFile The texture-file to load onto the crosshair
    101101 */
    102 void Billboard::setTexture(const char* textureFile)
     102void Billboard::setTexture(const std::string& textureFile)
    103103{
    104104  this->material->setDiffuseMap(textureFile);
  • trunk/src/lib/graphics/render2D/billboard.h

    r6815 r7221  
    3030
    3131    void setSize(float sizeX, float sizeY);
    32     void setTexture(const char* textureFile);
     32    void setTexture(const std::string& textureFile);
    3333    void attachTo(PNode* pnode);
    3434
  • trunk/src/lib/graphics/render2D/element_2d.cc

    r7199 r7221  
    180180 * @param alignment the alignment @see loadParams
    181181*/
    182 void Element2D::setAlignment(const char* alignment)
    183 {
    184   if (!strcmp(alignment, "center"))
     182void Element2D::setAlignment(const std::string& alignment)
     183{
     184  if (alignment == "center")
    185185    this->setAlignment(E2D_ALIGN_CENTER);
    186   else if (!strcmp(alignment, "left"))
     186  else if (alignment == "left")
    187187    this->setAlignment(E2D_ALIGN_LEFT);
    188   else if (!strcmp(alignment, "right"))
     188  else if (alignment == "right")
    189189    this->setAlignment(E2D_ALIGN_RIGHT);
    190   else if (!strcmp(alignment, "screen-center"))
     190  else if (alignment == "screen-center")
    191191    this->setAlignment(E2D_ALIGN_SCREEN_CENTER);
    192192}
     
    213213/**
    214214 * sets the layer onto which this 2D-element is projected to.
    215  * @param layer the layer @see loadParams @see Element2D::charToLayer2D(const char* layer)
    216  */
    217 void Element2D::setLayer(const char* layer)
     215 * @param layer the layer @see loadParams @see Element2D::charToLayer2D(const std::string& layer)
     216 */
     217void Element2D::setLayer(const std::string& layer)
    218218{
    219219  this->setLayer(Element2D::charToLayer2D(layer));
     
    235235 * @param bindNode the name of the Node (should be existing)
    236236 */
    237 void Element2D::setBindNode(const char* bindNode)
     237void Element2D::setBindNode(const std::string& bindNode)
    238238{
    239239  const PNode* tmpBindNode = dynamic_cast<const PNode*>(ClassList::getObject(bindNode, CL_PARENT_NODE));
     
    572572 * @param childName the name of the child to add to this PNode
    573573 */
    574 void Element2D::addChild2D (const char* childName)
     574void Element2D::addChild2D (const std::string& childName)
    575575{
    576576  Element2D* childNode = dynamic_cast<Element2D*>(ClassList::getObject(childName, CL_ELEMENT_2D));
     
    651651 * @param parentName the name of the Parent to set to this Element2D
    652652 */
    653 void Element2D::setParent2D (const char* parentName)
     653void Element2D::setParent2D (const std::string& parentName)
    654654{
    655655  Element2D* parentNode = dynamic_cast<Element2D*>(ClassList::getObject(parentName, CL_ELEMENT_2D));
     
    658658  else
    659659    PRINTF(2)("Not Found Element2D's (%s::%s) new Parent by Name: %s\n",
    660                 this->getClassName(), this->getName(), parentName);
     660                this->getClassName(), this->getName(), parentName.c_str());
    661661}
    662662
     
    704704 * @param bias the speed to iterate to this new Positions
    705705 */
    706 void Element2D::setParentSoft2D(const char* parentName, float bias)
     706void Element2D::setParentSoft2D(const std::string& parentName, float bias)
    707707{
    708708  Element2D* parentNode = dynamic_cast<Element2D*>(ClassList::getObject(parentName, CL_ELEMENT_2D));
     
    724724 * @param parentMode a String representing this parentingMode
    725725 */
    726 void Element2D::setParentMode2D (const char* parentingMode)
    727 {
    728   this->setParentMode2D(Element2D::charToParentingMode2D(parentingMode));
     726void Element2D::setParentMode2D (const std::string& parentingMode)
     727{
     728  this->setParentMode2D(Element2D::stringToParentingMode2D(parentingMode));
    729729}
    730730
     
    952952            this->relCoordinate.y,
    953953            this->getAbsDir2D(),
    954             Element2D::parentingModeToChar2D(parentMode),
     954            Element2D::parentingModeToString2D(parentMode),
    955955            Element2D::layer2DToChar(this->layer));
    956956
     
    10741074 * @return the converted string
    10751075 */
    1076 const char* Element2D::parentingModeToChar2D(int parentingMode)
     1076const char* Element2D::parentingModeToString2D(int parentingMode)
    10771077{
    10781078  if (parentingMode == E2D_PARENT_LOCAL_ROTATE)
     
    10931093 * @return the int corresponding to the named parentingMode
    10941094 */
    1095 E2D_PARENT_MODE Element2D::charToParentingMode2D(const char* parentingMode)
    1096 {
    1097   if (!strcmp(parentingMode, "local-rotate"))
     1095E2D_PARENT_MODE Element2D::stringToParentingMode2D(const std::string& parentingMode)
     1096{
     1097  if (parentingMode == "local-rotate")
    10981098    return (E2D_PARENT_LOCAL_ROTATE);
    1099   else  if (!strcmp(parentingMode, "rotate-movement"))
     1099  else  if (parentingMode == "rotate-movement")
    11001100    return (E2D_PARENT_ROTATE_MOVEMENT);
    1101   else  if (!strcmp(parentingMode, "movement"))
     1101  else  if (parentingMode == "movement")
    11021102    return (E2D_PARENT_MOVEMENT);
    1103   else  if (!strcmp(parentingMode, "all"))
     1103  else  if (parentingMode == "all")
    11041104    return (E2D_PARENT_ALL);
    1105   else  if (!strcmp(parentingMode, "rotate-and-move"))
     1105  else  if (parentingMode == "rotate-and-move")
    11061106    return (E2D_PARENT_ROTATE_AND_MOVE);
    11071107}
     
    11391139 * @returns the E2D_LAYER on success, E2D_DEFAULT_LAYER on error.
    11401140 */
    1141 E2D_LAYER Element2D::charToLayer2D(const char* layer)
    1142 {
    1143   if (!strcmp(layer, "top"))
     1141E2D_LAYER Element2D::charToLayer2D(const std::string& layer)
     1142{
     1143  if (layer =="top")
    11441144    return (E2D_LAYER_TOP);
    1145   else  if (!strcmp(layer, "medium"))
     1145  else  if (layer == "medium")
    11461146    return (E2D_LAYER_MEDIUM);
    1147   else  if (!strcmp(layer, "bottom"))
     1147  else  if (layer == "bottom")
    11481148    return (E2D_LAYER_BOTTOM);
    1149   else  if (!strcmp(layer, "below-all"))
     1149  else  if (layer == "below-all")
    11501150    return (E2D_LAYER_BELOW_ALL);
    11511151  else
  • trunk/src/lib/graphics/render2D/element_2d.h

    r7052 r7221  
    102102    /** @param alignment the new Alignment of the 2D-Element */
    103103    inline void setAlignment(E2D_ALIGNMENT alignment) { this->alignment = alignment; };
    104     void setAlignment(const char* alignment);
     104    void setAlignment(const std::string& alignment);
    105105    inline E2D_ALIGNMENT getAlignment() const { return this->alignment; };
    106106
    107107    // LAYERING //
    108108    void setLayer(E2D_LAYER layer);
    109     void setLayer(const char* layer);
     109    void setLayer(const std::string& layer);
    110110    /** @returns the Layer this Element is drawn to */
    111111    inline E2D_LAYER getLayer() const { return this->layer; };
     
    121121    /** @param bindNode the Node this 2D-element should follow. if NULL the Element will not follow anything */
    122122    inline void setBindNode(const PNode* bindNode) { this->bindNode = bindNode; };
    123     void setBindNode(const char* bindNode);
     123    void setBindNode(const std::string& bindNode);
    124124    inline const PNode* getBindNode() const { return this->bindNode; };
    125125
     
    181181
    182182    void addChild2D (Element2D* child);
    183     void addChild2D (const char* childName);
     183    void addChild2D (const std::string& childName);
    184184    void removeChild2D (Element2D* child);
    185185    void remove2D();
     
    187187    /** @param parent the new parent of this Element2D */
    188188    void setParent2D (Element2D* parent) { parent->addChild2D(this); };
    189     void setParent2D (const char* parentName);
     189    void setParent2D (const std::string& parentName);
    190190    /** @returns the parent of this Element2D */
    191191    inline Element2D* getParent2D () const { return this->parent; };
     
    194194
    195195    void setParentSoft2D(Element2D* parentNode, float bias = 1.0);
    196     void setParentSoft2D(const char* parentName, float bias = 1.0);
     196    void setParentSoft2D(const std::string& parentName, float bias = 1.0);
    197197
    198198    void setParentMode2D (E2D_PARENT_MODE parentMode);
    199     void setParentMode2D (const char* parentingMode);
     199    void setParentMode2D (const std::string& parentingMode);
    200200    /** @returns the Parenting mode of this node */
    201201    int getParentMode2D() const { return this->parentMode; };
     
    212212
    213213    // helper functions //
    214     static const char* parentingModeToChar2D(int parentingMode);
    215     static E2D_PARENT_MODE charToParentingMode2D(const char* parentingMode);
     214    static const char* parentingModeToString2D(int parentingMode);
     215    static E2D_PARENT_MODE stringToParentingMode2D(const std::string& parentingMode);
    216216
    217217    static const char* layer2DToChar(E2D_LAYER layer);
    218     static E2D_LAYER charToLayer2D(const char* layer);
     218    static E2D_LAYER charToLayer2D(const std::string& layer);
    219219
    220220  private:
Note: See TracChangeset for help on using the changeset viewer.