Changeset 5091 in orxonox.OLD for trunk/src/lib/graphics/render2D
- Timestamp:
- Aug 21, 2005, 10:14:59 PM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/lib/graphics/render2D/element_2d.cc
r5090 r5091 119 119 .describe("if the Element is visible or not"); 120 120 121 // LoadParam<Element2D>(root, "2d-position", this, &Element2D::setPosition2D) 122 // .describe("the _relative_ position (away from alignment) this 2d-element shows"); 123 121 122 // PNode-style: 123 LoadParam<Element2D>(root, "rel-coor", this, &Element2D::setRelCoor2D) 124 .describe("Sets The relative position of the Node to its parent."); 125 126 LoadParam<Element2D>(root, "abs-coor", this, &Element2D::setAbsCoor2D) 127 .describe("Sets The absolute Position of the Node."); 128 129 LoadParam<Element2D>(root, "rel-dir", this, &Element2D::setRelDir2D) 130 .describe("Sets The relative rotation of the Node to its parent."); 131 132 LoadParam<Element2D>(root, "abs-dir", this, &Element2D::setAbsDir2D) 133 .describe("Sets The absolute rotation of the Node."); 134 135 LoadParam<Element2D>(root, "parent", this, &Element2D::setParent2D) 136 .describe("the Name of the Parent of this Element2D"); 137 138 LoadParam<Element2D>(root, "parent-mode", this, &Element2D::setParentMode2D) 139 .describe("the mode to connect this node to its parent ()"); 140 141 // cycling properties 142 if (root != NULL) 143 { 144 const TiXmlElement* element = root->FirstChildElement(); 145 while (element != NULL) 146 { 147 LoadParam<Element2D>(root, "parent", this, &Element2D::addChild2D, true) 148 .describe("adds a new Child to the current Node."); 149 150 element = element->NextSiblingElement(); 151 } 152 } 124 153 } 125 154 … … 179 208 } 180 209 181 210 /** 211 * sets the relative coordinate of the Element2D to its parent 212 * @param relCoord the relative coordinate to the parent 213 */ 182 214 void Element2D::setRelCoor2D (const Vector& relCoord) 183 215 { … … 187 219 188 220 221 /** 222 * sets the relative coordinate of the Element2D to its Parent 223 * @param x the x coordinate 224 * @param y the y coordinate 225 * @param z the z coordinate 226 */ 189 227 void Element2D::setRelCoor2D (float x, float y, float z) 190 228 { … … 192 230 } 193 231 232 /** 233 * sets the Relative coordinate to the parent in Pixels 234 * @param x the relCoord X 235 * @param y the relCoord Y 236 */ 194 237 void Element2D::setRelCoor2Dpx (int x, int y) 195 238 { … … 200 243 } 201 244 202 245 /** 246 * sets a new relative position smoothely 247 * @param relCoordSoft the new Position to iterate to 248 * @param bias how fast to iterate to this position 249 */ 203 250 void Element2D::setRelCoorSoft2D(const Vector& relCoordSoft, float bias) 204 251 { … … 210 257 } 211 258 259 /** 260 * sets a new relative position smoothely 261 * @param x the new x-coordinate in Pixels of the Position to iterate to 262 * @param y the new y-coordinate in Pixels of the Position to iterate to 263 * @param bias how fast to iterate to this position 264 */ 212 265 void Element2D::setRelCoorSoft2Dpx (int x, int y, float bias) 213 266 { … … 218 271 } 219 272 220 273 /** 274 * set relative coordinates smoothely 275 * @param x x-relative coordinates to its parent 276 * @param y y-relative coordinates to its parent 277 * @param z z-relative coordinates to its parent 278 * @see void PNode::setRelCoorSoft (const Vector&, float) 279 */ 221 280 void Element2D::setRelCoorSoft2D(float x, float y, float depth, float bias) 222 281 { … … 224 283 } 225 284 285 /** 286 * @param absCoord set absolute coordinate 287 */ 226 288 void Element2D::setAbsCoor2D (const Vector& absCoord) 227 289 { … … 245 307 } 246 308 309 /** 310 * @param x x-coordinate. 311 * @param y y-coordinate. 312 * @param z z-coordinate. 313 * @see void PNode::setAbsCoor (const Vector& absCoord) 314 */ 247 315 void Element2D::setAbsCoor2D (float x, float y, float depth) 248 316 { … … 250 318 } 251 319 252 320 /** 321 * @param x x-coordinate in Pixels 322 * @param y y-coordinate in Pixels 323 * @see void PNode::setAbsCoor (const Vector& absCoord) 324 */ 253 325 void Element2D::setAbsCoor2Dpx (int x, int y) 254 326 { … … 259 331 } 260 332 333 /** 334 * shift coordinate ralative 335 * @param shift shift vector 336 * 337 * This simply adds the shift-Vector to the relative Coordinate 338 */ 261 339 void Element2D::shiftCoor2D (const Vector& shift) 262 340 { … … 266 344 } 267 345 268 346 /** 347 * shifts in PixelSpace 348 * @param x the pixels to shift in X 349 * @param y the pixels to shift in Y 350 */ 269 351 void Element2D::shiftCoor2Dpx (int x, int y) 270 352 { … … 274 356 } 275 357 276 358 /** 359 * set relative direction 360 * @param relDir to its parent 361 */ 277 362 void Element2D::setRelDir2D (float relDir) 278 363 { … … 281 366 } 282 367 368 /** 369 * sets the Relative Direction of this node to its parent in a Smoothed way 370 * @param relDirSoft the direction to iterate to smoothely. 371 * @param bias how fast to iterate to the new Direction 372 */ 283 373 void Element2D::setRelDirSoft2D(float relDirSoft, float bias) 284 374 { … … 290 380 } 291 381 382 /** 383 * sets the absolute direction 384 * @param absDir absolute coordinates 385 */ 292 386 void Element2D::setAbsDir2D (float absDir) 293 387 { … … 300 394 } 301 395 396 /** 397 * shift Direction 398 * @param shift the direction around which to shift. 399 */ 302 400 void Element2D::shiftDir2D (float shiftDir) 303 401 { … … 306 404 } 307 405 308 406 /** 407 * adds a child and makes this node to a parent 408 * @param child child reference 409 * @param parentMode on which changes the child should also change ist state 410 * 411 * use this to add a child to this node. 412 */ 309 413 void Element2D::addChild2D (Element2D* child, int parentingMod) 310 414 { … … 320 424 } 321 425 426 /** 427 * @see Element2D::addChild(Element2D* child); 428 * @param childName the name of the child to add to this PNode 429 */ 322 430 void Element2D::addChild2D (const char* childName) 323 431 { … … 327 435 } 328 436 437 /** 438 * removes a child from the node 439 * @param child the child to remove from this Node.. 440 * 441 * Children from nodes will not be lost, they are referenced to NullPointer 442 */ 329 443 void Element2D::removeChild2D (Element2D* child) 330 444 { … … 334 448 } 335 449 450 /** 451 * remove this pnode from the tree and adds all following to NullParent 452 * 453 * this can be the case, if an entity in the world is being destroyed. 454 */ 336 455 void Element2D::remove2D() 337 456 { … … 348 467 } 349 468 350 469 /** 470 * sets the parent of this Element2D 471 * @param parent the Parent to set 472 */ 351 473 void Element2D::setParent2D (Element2D* parent) 352 474 { … … 354 476 } 355 477 478 /** 479 * @see Element2D::setParent(Element2D* parent); 480 * @param parentName the name of the Parent to set to this Element2D 481 */ 356 482 void Element2D::setParent2D (const char* parentName) 357 483 { … … 362 488 } 363 489 364 490 /** 491 * does the reparenting in a very smooth way 492 * @param parentNode the new Node to connect this node to. 493 * @param bias the speed to iterate to this new Positions 494 */ 365 495 void Element2D::softReparent2D(Element2D* parentNode, float bias) 366 496 { … … 394 524 } 395 525 526 /** 527 * does the reparenting in a very smooth way 528 * @param parentName the name of the Parent to reconnect to 529 * @param bias the speed to iterate to this new Positions 530 */ 396 531 void Element2D::softReparent2D(const char* parentName, float bias) 397 532 { … … 401 536 } 402 537 403 538 /** 539 * sets the mode of this parent manually 540 * @param parentMode a String representing this parentingMode 541 */ 404 542 void Element2D::setParentMode2D (const char* parentingMode) 405 543 { … … 407 545 } 408 546 409 547 /** 548 * updates the absCoordinate/absDirection 549 * @param dt The time passed since the last update 550 551 this is used to go through the parent-tree to update all the absolute coordinates 552 and directions. this update should be done by the engine, so you don't have to 553 worry, normaly... 554 */ 410 555 void Element2D::update2D (float dt) 411 556 { … … 541 686 } 542 687 543 688 /** 689 * displays some information about this pNode 690 * @param depth The deph into which to debug the children of this Element2D to. 691 * (0: all children will be debugged, 1: only this Element2D, 2: this and direct children...) 692 * @param level The n-th level of the Node we draw (this is internal and only for nice output) 693 */ 544 694 void Element2D::debug (unsigned int depth, unsigned int level) const 545 695 { … … 578 728 #include "color.h" 579 729 730 /** 731 * displays the Element2D at its position with its rotation as a Plane. 732 */ 580 733 void Element2D::debugDraw2D(unsigned int depth, float size, Vector color) const 581 734 { … … 585 738 586 739 // helper functions // 740 /** 741 * converts a parentingMode into a string that is the name of it 742 * @param parentingMode the ParentingMode to convert 743 * @return the converted string 744 */ 587 745 const char* Element2D::parentingModeToChar2D(int parentingMode) 588 746 { … … 599 757 } 600 758 759 /** 760 * converts a parenting-mode-string into a int 761 * @param parentingMode the string naming the parentingMode 762 * @return the int corresponding to the named parentingMode 763 */ 601 764 E2D_PARENT_MODE Element2D::charToParentingMode2D(const char* parentingMode) 602 765 {
Note: See TracChangeset
for help on using the changeset viewer.