Changeset 7216 in orxonox.OLD for branches/std/src/lib/graphics/render2D
- Timestamp:
- Mar 12, 2006, 8:54:30 AM (19 years ago)
- Location:
- branches/std/src/lib/graphics/render2D
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/std/src/lib/graphics/render2D/billboard.cc
r7193 r7216 78 78 void Billboard::loadParams(const TiXmlElement* root) 79 79 { 80 LoadParam(root, "texture", this , Billboard, setTexture)80 LoadParam(root, "texture", this->material, Material, setDiffuseMap) 81 81 .describe("the texture-file to load onto the Billboard"); 82 82 … … 100 100 * @param textureFile The texture-file to load onto the crosshair 101 101 */ 102 void Billboard::setTexture(const char*textureFile)102 void Billboard::setTexture(const std::string& textureFile) 103 103 { 104 104 this->material->setDiffuseMap(textureFile); -
branches/std/src/lib/graphics/render2D/billboard.h
r6815 r7216 30 30 31 31 void setSize(float sizeX, float sizeY); 32 void setTexture(const char*textureFile);32 void setTexture(const std::string& textureFile); 33 33 void attachTo(PNode* pnode); 34 34 -
branches/std/src/lib/graphics/render2D/element_2d.cc
r7199 r7216 180 180 * @param alignment the alignment @see loadParams 181 181 */ 182 void Element2D::setAlignment(const char*alignment)183 { 184 if ( !strcmp(alignment, "center"))182 void Element2D::setAlignment(const std::string& alignment) 183 { 184 if (alignment == "center") 185 185 this->setAlignment(E2D_ALIGN_CENTER); 186 else if ( !strcmp(alignment, "left"))186 else if (alignment == "left") 187 187 this->setAlignment(E2D_ALIGN_LEFT); 188 else if ( !strcmp(alignment, "right"))188 else if (alignment == "right") 189 189 this->setAlignment(E2D_ALIGN_RIGHT); 190 else if ( !strcmp(alignment, "screen-center"))190 else if (alignment == "screen-center") 191 191 this->setAlignment(E2D_ALIGN_SCREEN_CENTER); 192 192 } … … 213 213 /** 214 214 * 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 */ 217 void Element2D::setLayer(const std::string& layer) 218 218 { 219 219 this->setLayer(Element2D::charToLayer2D(layer)); … … 235 235 * @param bindNode the name of the Node (should be existing) 236 236 */ 237 void Element2D::setBindNode(const char*bindNode)237 void Element2D::setBindNode(const std::string& bindNode) 238 238 { 239 239 const PNode* tmpBindNode = dynamic_cast<const PNode*>(ClassList::getObject(bindNode, CL_PARENT_NODE)); … … 572 572 * @param childName the name of the child to add to this PNode 573 573 */ 574 void Element2D::addChild2D (const char*childName)574 void Element2D::addChild2D (const std::string& childName) 575 575 { 576 576 Element2D* childNode = dynamic_cast<Element2D*>(ClassList::getObject(childName, CL_ELEMENT_2D)); … … 651 651 * @param parentName the name of the Parent to set to this Element2D 652 652 */ 653 void Element2D::setParent2D (const char*parentName)653 void Element2D::setParent2D (const std::string& parentName) 654 654 { 655 655 Element2D* parentNode = dynamic_cast<Element2D*>(ClassList::getObject(parentName, CL_ELEMENT_2D)); … … 658 658 else 659 659 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()); 661 661 } 662 662 … … 704 704 * @param bias the speed to iterate to this new Positions 705 705 */ 706 void Element2D::setParentSoft2D(const char*parentName, float bias)706 void Element2D::setParentSoft2D(const std::string& parentName, float bias) 707 707 { 708 708 Element2D* parentNode = dynamic_cast<Element2D*>(ClassList::getObject(parentName, CL_ELEMENT_2D)); … … 724 724 * @param parentMode a String representing this parentingMode 725 725 */ 726 void Element2D::setParentMode2D (const char*parentingMode)726 void Element2D::setParentMode2D (const std::string& parentingMode) 727 727 { 728 728 this->setParentMode2D(Element2D::charToParentingMode2D(parentingMode)); … … 1093 1093 * @return the int corresponding to the named parentingMode 1094 1094 */ 1095 E2D_PARENT_MODE Element2D::charToParentingMode2D(const char*parentingMode)1096 { 1097 if ( !strcmp(parentingMode, "local-rotate"))1095 E2D_PARENT_MODE Element2D::charToParentingMode2D(const std::string& parentingMode) 1096 { 1097 if (parentingMode == "local-rotate") 1098 1098 return (E2D_PARENT_LOCAL_ROTATE); 1099 else if ( !strcmp(parentingMode, "rotate-movement"))1099 else if (parentingMode == "rotate-movement") 1100 1100 return (E2D_PARENT_ROTATE_MOVEMENT); 1101 else if ( !strcmp(parentingMode, "movement"))1101 else if (parentingMode == "movement") 1102 1102 return (E2D_PARENT_MOVEMENT); 1103 else if ( !strcmp(parentingMode, "all"))1103 else if (parentingMode == "all") 1104 1104 return (E2D_PARENT_ALL); 1105 else if ( !strcmp(parentingMode, "rotate-and-move"))1105 else if (parentingMode == "rotate-and-move") 1106 1106 return (E2D_PARENT_ROTATE_AND_MOVE); 1107 1107 } … … 1139 1139 * @returns the E2D_LAYER on success, E2D_DEFAULT_LAYER on error. 1140 1140 */ 1141 E2D_LAYER Element2D::charToLayer2D(const char*layer)1142 { 1143 if ( !strcmp(layer, "top"))1141 E2D_LAYER Element2D::charToLayer2D(const std::string& layer) 1142 { 1143 if (layer =="top") 1144 1144 return (E2D_LAYER_TOP); 1145 else if ( !strcmp(layer, "medium"))1145 else if (layer == "medium") 1146 1146 return (E2D_LAYER_MEDIUM); 1147 else if ( !strcmp(layer, "bottom"))1147 else if (layer == "bottom") 1148 1148 return (E2D_LAYER_BOTTOM); 1149 else if ( !strcmp(layer, "below-all"))1149 else if (layer == "below-all") 1150 1150 return (E2D_LAYER_BELOW_ALL); 1151 1151 else -
branches/std/src/lib/graphics/render2D/element_2d.h
r7052 r7216 102 102 /** @param alignment the new Alignment of the 2D-Element */ 103 103 inline void setAlignment(E2D_ALIGNMENT alignment) { this->alignment = alignment; }; 104 void setAlignment(const char*alignment);104 void setAlignment(const std::string& alignment); 105 105 inline E2D_ALIGNMENT getAlignment() const { return this->alignment; }; 106 106 107 107 // LAYERING // 108 108 void setLayer(E2D_LAYER layer); 109 void setLayer(const char*layer);109 void setLayer(const std::string& layer); 110 110 /** @returns the Layer this Element is drawn to */ 111 111 inline E2D_LAYER getLayer() const { return this->layer; }; … … 121 121 /** @param bindNode the Node this 2D-element should follow. if NULL the Element will not follow anything */ 122 122 inline void setBindNode(const PNode* bindNode) { this->bindNode = bindNode; }; 123 void setBindNode(const char*bindNode);123 void setBindNode(const std::string& bindNode); 124 124 inline const PNode* getBindNode() const { return this->bindNode; }; 125 125 … … 181 181 182 182 void addChild2D (Element2D* child); 183 void addChild2D (const char*childName);183 void addChild2D (const std::string& childName); 184 184 void removeChild2D (Element2D* child); 185 185 void remove2D(); … … 187 187 /** @param parent the new parent of this Element2D */ 188 188 void setParent2D (Element2D* parent) { parent->addChild2D(this); }; 189 void setParent2D (const char*parentName);189 void setParent2D (const std::string& parentName); 190 190 /** @returns the parent of this Element2D */ 191 191 inline Element2D* getParent2D () const { return this->parent; }; … … 194 194 195 195 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); 197 197 198 198 void setParentMode2D (E2D_PARENT_MODE parentMode); 199 void setParentMode2D (const char*parentingMode);199 void setParentMode2D (const std::string& parentingMode); 200 200 /** @returns the Parenting mode of this node */ 201 201 int getParentMode2D() const { return this->parentMode; }; … … 213 213 // helper functions // 214 214 static const char* parentingModeToChar2D(int parentingMode); 215 static E2D_PARENT_MODE charToParentingMode2D(const char*parentingMode);215 static E2D_PARENT_MODE charToParentingMode2D(const std::string& parentingMode); 216 216 217 217 static const char* layer2DToChar(E2D_LAYER layer); 218 static E2D_LAYER charToLayer2D(const char*layer);218 static E2D_LAYER charToLayer2D(const std::string& layer); 219 219 220 220 private:
Note: See TracChangeset
for help on using the changeset viewer.