Changeset 4858 in orxonox.OLD for orxonox/trunk/src/lib/graphics/render2D/element_2d.cc
- Timestamp:
- Jul 14, 2005, 12:43:39 AM (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/trunk/src/lib/graphics/render2D/element_2d.cc
r4856 r4858 21 21 #include "graphics_engine.h" 22 22 #include "p_node.h" 23 #include "load_param.h" 24 #include "tinyxml.h" 25 #include "class_list.h" 23 26 24 27 using namespace std; … … 44 47 45 48 49 /** 50 * initializes a Element2D 51 */ 46 52 void Element2D::init() 47 53 { … … 52 58 53 59 Render2D::getInstance()->registerElement2D(this); 60 } 61 62 /** 63 * Loads the Parameters of an Element2D from... 64 * @param root The XML-element to load from 65 */ 66 void Element2D::loadParams(const TiXmlElement* root) 67 { 68 LoadParam<Element2D>(root, "alignment", this, &Element2D::setAlignment) 69 .describe("loads the alignment: (either: center, left, right or screen-center)"); 70 71 LoadParam<Element2D>(root, "layer", this, &Element2D::setLayer) 72 .describe("loads the layer onto which to project: (either: top, medium, bottom, below-all)"); 73 74 LoadParam<Element2D>(root, "bind-node", this, &Element2D::setBindNode) 75 .describe("sets a node, this 2D-Element should be shown upon (name of the node)"); 76 77 LoadParam<Element2D>(root, "2d-position", this, &Element2D::setPosition2D) 78 .describe("the _relative_ position (away from alignment) this 2d-element shows"); 79 80 // LoadParam<Element2D>(root, "visibility", this, &Element2D::setVisibility) 81 // .describe("if the Element is visible or not"); 82 } 83 84 /** 85 * sets the alignment of the 2D-element in form of a String 86 * @param alignment the alignment @see loadParams 87 */ 88 void Element2D::setAlignment(const char* alignment) 89 { 90 if (!strcmp(alignment, "center")) 91 this->setAlignment(E2D_ALIGN_CENTER); 92 else if (!strcmp(alignment, "left")) 93 this->setAlignment(E2D_ALIGN_LEFT); 94 else if (!strcmp(alignment, "right")) 95 this->setAlignment(E2D_ALIGN_RIGHT); 96 else if (!strcmp(alignment, "screen-center")) 97 this->setAlignment(E2D_ALIGN_SCREEN_CENTER); 98 } 99 100 /** 101 * sets the layer onto which this 2D-element is projected to. 102 * @param layer the layer @see loadParams 103 */ 104 void Element2D::setLayer(const char* layer) 105 { 106 if (!strcmp(layer, "top")) 107 this->setLayer(E2D_TOP); 108 else if (!strcmp(layer, "medium")) 109 this->setLayer(E2D_MEDIUM); 110 else if (!strcmp(layer, "bottom")) 111 this->setLayer(E2D_BOTTOM); 112 else if (!strcmp(layer, "below-all")) 113 this->setLayer(E2D_BELOW_ALL); 114 } 115 116 117 /** 118 * sets a node, this 2D-Element should be shown upon 119 * @param bindNode the name of the Node (should be existing) 120 */ 121 void Element2D::setBindNode(const char* bindNode) 122 { 123 const PNode* tmpBindNode = dynamic_cast<const PNode*>(ClassList::getObject(bindNode, CL_PARENT_NODE)); 124 if (tmpBindNode != NULL) 125 this->bindNode = tmpBindNode; 54 126 } 55 127
Note: See TracChangeset
for help on using the changeset viewer.