Changeset 7330 in orxonox.OLD for trunk/src/lib
- Timestamp:
- Apr 18, 2006, 2:54:34 PM (19 years ago)
- Location:
- trunk/src/lib
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/lib/graphics/render2D/element_2d.cc
r7316 r7330 28 28 29 29 #include "color.h" 30 31 //#include "shell_command.h" 32 //SHELL_COMMAND(debug, Element2D, debug2D); 30 33 31 34 using namespace std; … … 209 212 } 210 213 this->layer = layer; 214 215 216 if (this->parent != NULL) 217 this->parent->children.sort(layerSortPredicate); 211 218 } 212 219 … … 510 517 511 518 /** 512 * adds a child and makes this node to a parent519 * @brief adds a child and makes this node to a parent 513 520 * @param child child reference 514 521 * @param parentMode on which changes the child should also change ist state … … 573 580 574 581 /** 575 * removes a child from the node582 * @brief removes a child from the node 576 583 * @param child the child to remove from this Node.. 577 584 * … … 693 700 694 701 /** 695 * does the reparenting in a very smooth way702 * @brief does the reparenting in a very smooth way 696 703 * @param parentName the name of the Parent to reconnect to 697 704 * @param bias the speed to iterate to this new Positions … … 720 727 { 721 728 this->setParentMode2D(Element2D::stringToParentingMode2D(parentingMode)); 729 } 730 731 /** 732 * @brief checks if elem1 is in a deeper layer as elem2 733 * @param elem1 the first Element2D 734 * @param elem2 the second Element2D 735 * @returns true if elem1->layer < elem2->layer 736 */ 737 bool Element2D::layerSortPredicate(const Element2D* elem1, const Element2D* elem2) 738 { 739 return elem1->layer < elem2->layer; 722 740 } 723 741 … … 757 775 758 776 /** 759 * updates the absCoordinate/absDirection777 * @brief updates the absCoordinate/absDirection 760 778 * @param dt The time passed since the last update 761 779 … … 997 1015 998 1016 /** 999 * displays the Element2D at its position with its rotation as a Plane.1017 * @brief displays the Element2D at its position with its rotation as a Plane. 1000 1018 */ 1001 1019 void Element2D::debugDraw2D(unsigned int depth, float size, Vector color, unsigned int level) const … … 1061 1079 // helper functions // 1062 1080 /** 1063 * converts a parentingMode into a string that is the name of it1081 * @brief converts a parentingMode into a string that is the name of it 1064 1082 * @param parentingMode the ParentingMode to convert 1065 1083 * @return the converted string … … 1080 1098 1081 1099 /** 1082 * converts a parenting-mode-string into a int1100 * @brief converts a parenting-mode-string into a int 1083 1101 * @param parentingMode the string naming the parentingMode 1084 1102 * @return the int corresponding to the named parentingMode … … 1099 1117 1100 1118 /** 1101 * converts a layer into its corresponding string1119 * @brief converts a layer into its corresponding string 1102 1120 * @param layer the layer to get the name-String of. 1103 1121 * @returns the Name of the Layer (on error the default-layer-string is returned) … … 1107 1125 switch(layer) 1108 1126 { 1127 case E2D_LAYER_ABOVE_ALL: 1128 return "above-all"; 1109 1129 case E2D_LAYER_TOP: 1110 1130 return "top"; 1111 break;1112 1131 case E2D_LAYER_MEDIUM: 1113 1132 return "medium"; 1114 break;1115 1133 case E2D_LAYER_BOTTOM: 1116 1134 return "bottom"; 1117 break;1118 1135 case E2D_LAYER_BELOW_ALL: 1119 1136 return "below-all"; 1120 break;1121 1137 default: 1138 assert (false); 1122 1139 return layer2DToChar(E2D_DEFAULT_LAYER); 1123 break; 1124 } 1125 } 1126 1127 /** 1128 * converts a String holding a actual Layer 1140 } 1141 } 1142 1143 /** 1144 * @brief converts a String holding a actual Layer 1129 1145 * @param layer the String to convert into a Layer2D 1130 1146 * @returns the E2D_LAYER on success, E2D_DEFAULT_LAYER on error. … … 1132 1148 E2D_LAYER Element2D::charToLayer2D(const std::string& layer) 1133 1149 { 1134 if (layer =="top") 1150 if (layer == "above-all") 1151 return (E2D_LAYER_ABOVE_ALL); 1152 if (layer == "top") 1135 1153 return (E2D_LAYER_TOP); 1136 1154 else if (layer == "medium") -
trunk/src/lib/graphics/render2D/element_2d.h
r7316 r7330 24 24 E2D_LAYER_MEDIUM = 2, //!< Will be rendered on the medium Layer. 25 25 E2D_LAYER_TOP = 3, //!< Will be rendered on top of everything else 26 27 E2D_LAYER_COUNT = 4, //!< The count of Layers. 26 E2D_LAYER_ABOVE_ALL = 4, //!< Will be rendered above everything else. 27 28 E2D_LAYER_COUNT = 5, //!< The count of Layers. 28 29 } E2D_LAYER; 29 30 #define E2D_DEFAULT_LAYER E2D_LAYER_MEDIUM 30 #define E2D_LAYER_ALL 431 #define E2D_LAYER_ALL 5 31 32 32 33 typedef enum … … 218 219 static E2D_LAYER charToLayer2D(const std::string& layer); 219 220 221 static bool layerSortPredicate(const Element2D* elem1, const Element2D* elem2); 222 220 223 private: 221 224 void eraseChild2D(Element2D* child); -
trunk/src/lib/shell/shell.cc
r7316 r7330 78 78 // INPUT LINE 79 79 this->shellInput = new ShellInput; 80 this->shellInput->setLayer(E2D_LAYER_ABOVE_ALL); 80 81 81 82 this->backgroundMaterial = new Material; 82 83 // Element2D and generals 83 84 this->setAbsCoor2D(3, -400); 85 this->setLayer(E2D_LAYER_ABOVE_ALL); 84 86 this->textSize = 20; 85 87 this->lineSpacing = 0; … … 311 313 { 312 314 bufferText[i] = new Text(this->fontFile, this->textSize); 315 bufferText[i]->setLayer(E2D_LAYER_ABOVE_ALL); 313 316 bufferText[i]->setAlignment(TEXT_ALIGN_LEFT); 314 317 bufferText[i]->setParent2D(this);
Note: See TracChangeset
for help on using the changeset viewer.