Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/trunk/src/lib/graphics/render2D/element_2d.cc @ 9357

Last change on this file since 9357 was 8989, checked in by bensch, 18 years ago

orxonox/trunk: notifier notifies

File size: 35.9 KB
RevLine 
[4744]1/*
[1853]2   orxonox - the future of 3D-vertical-scrollers
3
4   Copyright (C) 2004 orx
5
6   This program is free software; you can redistribute it and/or modify
7   it under the terms of the GNU General Public License as published by
8   the Free Software Foundation; either version 2, or (at your option)
9   any later version.
[1855]10
11   ### File Specific:
[4838]12   main-programmer: Benjamin Grauer
[1855]13   co-programmer: ...
[1853]14*/
15
[3955]16//#define DEBUG_SPECIAL_MODULE DEBUG_MODULE_
[1853]17
[4839]18#include "element_2d.h"
[4840]19#include "render_2d.h"
[1853]20
[6142]21#include <algorithm>
22
[7843]23// ONLY IF PNODE ENABLED //
24#include "state.h"
[5775]25#include "p_node.h"
[7843]26#include "camera.h"
27///////////////////////////
[5775]28
[4843]29#include "graphics_engine.h"
[7193]30#include "util/loading/load_param.h"
[4858]31#include "class_list.h"
[5775]32
[5285]33#include "color.h"
[4843]34
[7332]35#include "shell_command.h"
[8360]36SHELL_COMMAND(debug, Element2D, debug2D);
[7330]37
[1853]38
[5285]39/**
[6295]40 * @brief standard constructor
[5285]41 * @param parent the parent to set for this Element2D
42 *
43 * NullElement2D needs this constructor with parameter NULL to initialize
44 * itself. Otherwise it would result in an endless Loop.
45 */
[6299]46Element2D::Element2D (Element2D* parent, E2D_LAYER layer, short nodeFlags)
[3365]47{
[6299]48  this->setClassID(CL_ELEMENT_2D, "Element2D");
49
50  this->setVisibility(true);
[7843]51  this->bCurrentlyVisible = true;
[6299]52  this->activate2D();
53  this->setAlignment(E2D_ALIGN_NONE);
54  this->bindNode = NULL;
55
56  this->parentMode = nodeFlags;
57  this->parent = NULL;
58  this->absDirection = 0.0;
59  this->relDirection = 0.0;
60  this->bRelCoorChanged = true;
61  this->bRelDirChanged = true;
62  this->toCoordinate = NULL;
63  this->toDirection = NULL;
[7919]64
65  this->size = Vector2D(0,0);
[7031]66  this->toSize = NULL;
[6299]67
68
[5402]69  this->layer = layer;
[6299]70  if (parent != NULL)
71    parent->addChild2D(this);
[3365]72}
[1853]73
[6299]74
[3245]75/**
[6299]76 * @brief the mighty NullElement
77 * TopMost Node of them all.
78 */
79Element2D* Element2D::nullElement = NULL;
80
81
82/**
[6295]83 * @brief standard deconstructor
[5285]84 *
85 * There are two general ways to delete an Element2D
86 * 1. delete instance;
87 *   -> result
88 *    delete this Node and all its children and children's children...
89 *    (danger if you still want the instance!!)
90 *
91 * 2. instance->remove2D(); delete instance;
92 *   -> result:
[5401]93 *    moves its children to the NullElement2D
[5285]94 *    then deletes the Element.
95 */
[4838]96Element2D::~Element2D ()
[3543]97{
[6299]98  // remove the Element2D, delete it's children (if required).
99  std::list<Element2D*>::iterator tmp = this->children.begin();
100  std::list<Element2D*>::iterator deleteNode;
101  while(!this->children.empty())
102    while (tmp != this->children.end())
103    {
104      deleteNode = tmp;
105      tmp++;
[7332]106      //      printf("TEST::%s(%s) %s\n", (*deleteNode)->getName(), (*deleteNode)->getClassName(), this->getName());
[6299]107      if ((this->parentMode & E2D_PROHIBIT_CHILD_DELETE) ||
108          ((*deleteNode)->parentMode & E2D_PROHIBIT_DELETE_WITH_PARENT))
109      {
110        if (this == Element2D::nullElement && (*deleteNode)->parentMode & E2D_REPARENT_TO_NULL)
111          delete (*deleteNode);
112        else
113          (*deleteNode)->reparent2D();
114      }
115      else
116        delete (*deleteNode);
117    }
118
[5285]119  if (this->parent != NULL)
120  {
[6299]121    this->parent->eraseChild2D(this);
[5285]122    this->parent = NULL;
123  }
[5089]124
[5285]125  // remove all other allocated memory.
[5088]126  if (this->toCoordinate != NULL)
127    delete this->toCoordinate;
128  if (this->toDirection != NULL)
129    delete this->toDirection;
[7727]130  if (this->toSize != NULL)
131    delete this->toSize;
[6299]132
133  if (this == Element2D::nullElement)
134    Element2D::nullElement = NULL;
[3543]135}
[4843]136
137
[4858]138/**
[6295]139 * @brief Loads the Parameters of an Element2D from...
[4858]140 * @param root The XML-element to load from
141 */
142void Element2D::loadParams(const TiXmlElement* root)
143{
[6512]144  BaseObject::loadParams(root);
145
[5402]146  // ELEMENT2D-native settings.
[5671]147  LoadParam(root, "alignment", this, Element2D, setAlignment)
[7332]148  .describe("loads the alignment: (either: center, left, right or screen-center)");
[4858]149
[5671]150  LoadParam(root, "layer", this, Element2D, setLayer)
[7332]151  .describe("loads the layer onto which to project: (either: top, medium, bottom, below-all)");
[4858]152
[5671]153  LoadParam(root, "bind-node", this, Element2D, setBindNode)
[7332]154  .describe("sets a node, this 2D-Element should be shown upon (name of the node)");
[4858]155
[5671]156  LoadParam(root, "visibility", this, Element2D, setVisibility)
[7332]157  .describe("if the Element is visible or not");
[5089]158
159
[7332]160  // PNode-style:
[6878]161  LoadParam(root, "rel-coor-2d", this, Element2D, setRelCoor2D)
[7332]162  .describe("Sets The relative position of the Node to its parent.");
[5091]163
[6878]164  LoadParam(root, "abs-coor-2d", this, Element2D, setAbsCoor2D)
[7332]165  .describe("Sets The absolute Position of the Node.");
[5091]166
[6878]167  LoadParam(root, "rel-dir-2d", this, Element2D, setRelDir2D)
[7332]168  .describe("Sets The relative rotation of the Node to its parent.");
[5091]169
[6878]170  LoadParam(root, "abs-dir-2d", this, Element2D, setAbsDir2D)
[7332]171  .describe("Sets The absolute rotation of the Node.");
[5091]172
[5671]173  LoadParam(root, "parent", this, Element2D, setParent2D)
[7332]174  .describe("the Name of the Parent of this Element2D");
[5091]175
[5671]176  LoadParam(root, "parent-mode", this, Element2D, setParentMode2D)
[7332]177  .describe("the mode to connect this node to its parent ()");
[5091]178
179  // cycling properties
[6295]180  LOAD_PARAM_START_CYCLE(root, element);
[5091]181  {
[6299]182    LoadParam_CYCLE(element, "child", this, Element2D, addChild2D)
[7332]183    .describe("adds a new Child to the current Node.");
[5091]184  }
[6295]185  LOAD_PARAM_END_CYCLE(element);
[4858]186}
187
188/**
[7342]189 * @brief sets the alignment of the 2D-element in form of a String
[4858]190 * @param alignment the alignment @see loadParams
191*/
[7221]192void Element2D::setAlignment(const std::string& alignment)
[4858]193{
[7221]194  if (alignment == "center")
[4858]195    this->setAlignment(E2D_ALIGN_CENTER);
[7221]196  else if (alignment == "left")
[4858]197    this->setAlignment(E2D_ALIGN_LEFT);
[7221]198  else if (alignment == "right")
[4858]199    this->setAlignment(E2D_ALIGN_RIGHT);
[7221]200  else if (alignment == "screen-center")
[4858]201    this->setAlignment(E2D_ALIGN_SCREEN_CENTER);
202}
203
[4862]204
[4858]205/**
[7840]206 * @brief moves a Element to another layer
[4862]207 * @param layer the Layer this is drawn on
208 */
209void Element2D::setLayer(E2D_LAYER layer)
210{
[7341]211  if (unlikely(this->layer == layer)) return;
212
[5402]213  if (this->parent != NULL && this->parent->getLayer() > layer)
214  {
[5403]215    PRINTF(2)("Unable to set %s to layer %s, because it's parent(%s) is of higher layer %s\n",
216              this->getName(),
217              Element2D::layer2DToChar(layer),
218              this->parent->getName(),
219              Element2D::layer2DToChar(this->parent->getLayer()));
[5402]220    layer = this->parent->getLayer();
221  }
[4862]222  this->layer = layer;
[7330]223
224
225  if (this->parent != NULL)
226    this->parent->children.sort(layerSortPredicate);
[4862]227}
228
229/**
[7342]230 * @brief sets the layer onto which this 2D-element is projected to.
[7221]231 * @param layer the layer @see loadParams @see Element2D::charToLayer2D(const std::string& layer)
[4858]232 */
[7221]233void Element2D::setLayer(const std::string& layer)
[4858]234{
[5401]235  this->setLayer(Element2D::charToLayer2D(layer));
[4858]236}
237
[7846]238/**
239 * @brief sets the Size of the Element2D softly.
240 * @param x the x-coordinate
241 * @param y the y-coordinate.
242 * @param bias the bias (bigger = faster).
243 */
[7031]244void Element2D::setSizeSoft2D(float x, float y, float bias)
245{
246  if (likely(this->toSize == NULL))
247    this->toSize = new Vector2D();
[4858]248
[7031]249  *this->toSize = Vector2D(x,y);;
250  this->bias = bias;
251}
252
253
[7843]254/**
255 * @brief sets a node, this 2D-Element should be shown upon
256 * @param bindNode the Node of the Node. (if NULL it will be unset).
257 */
258void Element2D::setBindNode(const PNode* bindNode)
259{
260  this->bindNode = bindNode;
[7845]261  this->bCurrentlyVisible = (bindNode == NULL);
[7843]262}
[7031]263
[4858]264/**
[6299]265 * @brief sets a node, this 2D-Element should be shown upon
[4858]266 * @param bindNode the name of the Node (should be existing)
267 */
[7221]268void Element2D::setBindNode(const std::string& bindNode)
[4858]269{
270  const PNode* tmpBindNode = dynamic_cast<const PNode*>(ClassList::getObject(bindNode, CL_PARENT_NODE));
271  if (tmpBindNode != NULL)
272    this->bindNode = tmpBindNode;
273}
274
[5091]275/**
[7840]276 * @brief sets the relative coordinate of the Element2D to its parent
[5091]277 * @param relCoord the relative coordinate to the parent
278 */
[7316]279void Element2D::setRelCoor2D (const Vector2D& relCoord)
[5081]280{
[5113]281  if (this->toCoordinate!= NULL)
282  {
283    delete this->toCoordinate;
284    this->toCoordinate = NULL;
285  }
[5082]286  this->relCoordinate = relCoord;
287  this->bRelCoorChanged = true;
[5081]288}
289
[5091]290/**
[7840]291 * @brief sets the relative coordinate of the Element2D to its Parent
[5091]292 * @param x the x coordinate
293 * @param y the y coordinate
294 */
[7316]295void Element2D::setRelCoor2D (float x, float y)
[5081]296{
[7316]297  this->setRelCoor2D(Vector2D(x,y));
[5081]298}
299
[5091]300/**
[8035]301 * @brief updates the Rel - Coordinate in x-direction
302 * @param x the x coordinate
303 */
304void Element2D::setRelCoorX2D(float x)
305{
306  this->setRelCoor2D(Vector2D(x, this->relCoordinate.y));
307}
308
309/**
310 * @brief updates the Rel - Coordinate in y-direction
311 * @param y the y coordinate
312 */
313void Element2D::setRelCoorY2D(float y)
314{
315  this->setRelCoor2D(Vector2D(this->relCoordinate.x, y));
316}
317
318
319/**
[7840]320 * @brief sets the Relative coordinate to the parent in Pixels
[5091]321 * @param x the relCoord X
322 * @param y the relCoord Y
323 */
[5089]324void Element2D::setRelCoor2Dpx (int x, int y)
325{
[7316]326  this->setRelCoor2D(Vector2D((float)x/(float)GraphicsEngine::getInstance()->getResolutionX(),
[7332]327                              (float)y/(float)GraphicsEngine::getInstance()->getResolutionY()));
[5089]328}
329
[5091]330/**
[7840]331 * @brief sets a new relative position smoothely
[5091]332 * @param relCoordSoft the new Position to iterate to
333 * @param bias how fast to iterate to this position
334 */
[7316]335void Element2D::setRelCoorSoft2D(const Vector2D& relCoordSoft, float bias)
[5081]336{
[5082]337  if (likely(this->toCoordinate == NULL))
[7316]338    this->toCoordinate = new Vector2D();
[5082]339
340  *this->toCoordinate = relCoordSoft;
341  this->bias = bias;
[5081]342}
343
[5091]344/**
[7840]345 * @brief sets a new relative position smoothely
[5091]346 * @param x the new x-coordinate in Pixels of the Position to iterate to
347 * @param y the new y-coordinate in Pixels of the Position to iterate to
348 * @param bias how fast to iterate to this position
349 */
[5089]350void Element2D::setRelCoorSoft2Dpx (int x, int y, float bias)
351{
[7316]352  this->setRelCoorSoft2D(Vector2D((float)x/(float)GraphicsEngine::getInstance()->getResolutionX(),
[7332]353                                  (float)y/(float)GraphicsEngine::getInstance()->getResolutionY()),
[5089]354                         bias);
355}
356
[5091]357/**
[7840]358 * @brief set relative coordinates smoothely
[5091]359 * @param x x-relative coordinates to its parent
360 * @param y y-relative coordinates to its parent
361 * @param z z-relative coordinates to its parent
[7316]362 * @see  void PNode::setRelCoorSoft (const Vector2D&, float)
[5091]363 */
[7316]364void Element2D::setRelCoorSoft2D(float x, float y, float bias)
[5081]365{
[7316]366  this->setRelCoorSoft2D(Vector2D(x, y), bias);
[5081]367}
368
[5091]369/**
370 * @param absCoord set absolute coordinate
371 */
[7316]372void Element2D::setAbsCoor2D (const Vector2D& absCoord)
[5081]373{
[5113]374  if (this->toCoordinate!= NULL)
375  {
376    delete this->toCoordinate;
377    this->toCoordinate = NULL;
378  }
379
[5082]380  if( likely(this->parentMode & E2D_PARENT_MOVEMENT))
381  {
382    /* if you have set the absolute coordinates this overrides all other changes */
383    if (likely(this->parent != NULL))
384      this->relCoordinate = absCoord - parent->getAbsCoor2D ();
385    else
386      this->relCoordinate = absCoord;
387  }
388  if( this->parentMode & E2D_PARENT_ROTATE_MOVEMENT)
389  {
390    if (likely(this->parent != NULL))
391      this->relCoordinate = absCoord - parent->getAbsCoor2D ();
392    else
393      this->relCoordinate = absCoord;
394  }
395
396  this->bRelCoorChanged = true;
[5081]397}
398
[5091]399/**
400 * @param x x-coordinate.
401 * @param y y-coordinate.
402 * @param z z-coordinate.
[7316]403 * @see void PNode::setAbsCoor (const Vector2D& absCoord)
[5091]404 */
[7316]405void Element2D::setAbsCoor2D (float x, float y)
[5081]406{
[7316]407  this->setAbsCoor2D(Vector2D(x, y));
[5081]408}
409
[5091]410/**
[8035]411 * @brief updates the Abs - Coordinate in x-direction
412 * @param x the x coordinate
413 */
414void Element2D::setAbsCoorX2D(float x)
415{
416  this->setAbsCoor2D(x, this->getAbsCoor2D().y);
417}
418
419/**
420 * @brief updates the Abs - Coordinate in y-direction
421 * @param y the y coordinate
422 */
423void Element2D::setAbsCoorY2D(float y)
424{
425  this->setAbsCoor2D(this->getAbsCoor2D().x, y);
426}
427
428
429/**
[5091]430 * @param x x-coordinate in Pixels
431 * @param y y-coordinate in Pixels
[7316]432 * @see void PNode::setAbsCoor (const Vector2D& absCoord)
[5091]433 */
[5089]434void Element2D::setAbsCoor2Dpx (int x, int y)
435{
[7316]436  this->setAbsCoor2D(Vector2D((float)x/(float)GraphicsEngine::getInstance()->getResolutionX(),
[7332]437                              (float)y/(float)GraphicsEngine::getInstance()->getResolutionY()));
[5089]438}
439
[5091]440/**
[5414]441 * @param absCoordSoft set absolute coordinate
442 * @param bias how fast to iterato to the new Coordinate
443 */
[7316]444void Element2D::setAbsCoorSoft2D (const Vector2D& absCoordSoft, float bias)
[5414]445{
446  if (this->toCoordinate == NULL)
[7316]447    this->toCoordinate = new Vector2D();
[5414]448
449  if( likely(this->parentMode & E2D_PARENT_MOVEMENT))
450  {
451    /* if you have set the absolute coordinates this overrides all other changes */
452    if (likely(this->parent != NULL))
453      *this->toCoordinate = absCoordSoft - parent->getAbsCoor2D ();
454    else
455      *this->toCoordinate = absCoordSoft;
456  }
457  if( this->parentMode & E2D_PARENT_ROTATE_MOVEMENT)
458  {
459    if (likely(this->parent != NULL))
460      *this->toCoordinate = absCoordSoft - parent->getAbsCoor2D ();
461    else
462      *this->toCoordinate = absCoordSoft;
463  }
464
465  this->bias = bias;
466}
467
468/**
469 * @param x x-coordinate.
470 * @param y y-coordinate.
471 * @param z z-coordinate.
[7316]472 * @see void PNode::setAbsCoor (const Vector2D& absCoord)
[5414]473 */
[7316]474void Element2D::setAbsCoorSoft2D (float x, float y, float bias)
[5414]475{
[7316]476  this->setAbsCoorSoft2D(Vector2D(x, y), bias);
[5414]477}
478
479/**
[7840]480 * @brief shift coordinate ralative
[5091]481 * @param shift shift vector
482 *
[7316]483 * This simply adds the shift-Vector2D to the relative Coordinate
[5091]484 */
[7316]485void Element2D::shiftCoor2D (const Vector2D& shift)
[5081]486{
[5082]487  this->relCoordinate += shift;
488  this->bRelCoorChanged = true;
[5081]489}
490
[5091]491/**
[7840]492 * @brief shifts in PixelSpace
[5091]493 * @param x the pixels to shift in X
494 * @param y the pixels to shift in Y
495 */
[5089]496void Element2D::shiftCoor2Dpx (int x, int y)
497{
[7316]498  this->shiftCoor2D(Vector2D((float)x/(float)GraphicsEngine::getInstance()->getResolutionX(),
[7332]499                             (float)y/(float)GraphicsEngine::getInstance()->getResolutionY()));
[5089]500}
501
[5091]502/**
[7840]503 * @brief set relative direction
[5091]504 * @param relDir to its parent
505 */
[5081]506void Element2D::setRelDir2D (float relDir)
507{
[5113]508  if (this->toDirection!= NULL)
509  {
510    delete this->toDirection;
511    this->toDirection = NULL;
512  }
513
[5082]514  this->relDirection = relDir;
515  this->bRelDirChanged = true;
[5081]516}
517
[5091]518/**
[7840]519 * @brief sets the Relative Direction of this node to its parent in a Smoothed way
[5091]520 * @param relDirSoft the direction to iterate to smoothely.
521 * @param bias how fast to iterate to the new Direction
522 */
[5081]523void Element2D::setRelDirSoft2D(float relDirSoft, float bias)
524{
[5082]525  if (likely(this->toDirection == NULL))
526    this->toDirection = new float;
527
528  *this->toDirection = relDirSoft;
529  this->bias = bias;
[5081]530}
531
[5091]532/**
[7840]533 * @brief sets the absolute direction
[5091]534 * @param absDir absolute coordinates
535 */
[5081]536void Element2D::setAbsDir2D (float absDir)
537{
[5113]538  if (this->toDirection!= NULL)
539  {
540    delete this->toDirection;
541    this->toDirection = NULL;
542  }
543
[5082]544  if (likely(this->parent != NULL))
545    this->relDirection = absDir - this->parent->getAbsDir2D();
546  else
547    this->relDirection = absDir;
548
549  this->bRelDirChanged = true;
[5081]550}
551
[5091]552/**
[7840]553 * @brief sets the absolute direction softly
[5414]554 * @param absDir absolute coordinates
555 */
556void Element2D::setAbsDirSoft2D (float absDirSoft, float bias)
557{
558  if (this->toDirection == NULL)
559    this->toDirection = new float;
560
561  if (likely(this->parent != NULL))
562    *this->toDirection = absDirSoft - this->parent->getAbsDir2D();
563  else
564    *this->toDirection = absDirSoft;
565
566  this->bias = bias;
567}
568
569/**
[5091]570 * shift Direction
571 * @param shift the direction around which to shift.
572 */
[5083]573void Element2D::shiftDir2D (float shiftDir)
[5081]574{
[5082]575  this->relDirection = this->relDirection + shiftDir;
576  this->bRelDirChanged = true;
[5081]577}
578
[5091]579/**
[7330]580 * @brief adds a child and makes this node to a parent
[5091]581 * @param child child reference
582 * @param parentMode on which changes the child should also change ist state
583 *
584 * use this to add a child to this node.
585 */
[5403]586void Element2D::addChild2D (Element2D* child)
[5081]587{
[6295]588  assert(child != NULL);
[5082]589  if( likely(child->parent != NULL))
590  {
[5254]591    PRINTF(5)("Element2D::addChild() - reparenting node: removing it and adding it again\n");
[6299]592    child->parent->eraseChild2D(child);
[5082]593  }
[6299]594  if (this->checkIntegrity(child))
[5402]595  {
[7332]596    // Setting the New Parent.
[6299]597    child->parent = this;
598    if (likely(this != NULL))
[5403]599    {
[7332]600      // Layers of Children that are smaller than this(parents) Layer will be updated, and pushed to the front.
601      if (unlikely(this->layer > child->getLayer()))
602      {
603        PRINTF(2)("Layer '%s' of Child(%s::%s) lower than parents(%s::%s) layer '%s'. updating...\n",
604                  Element2D::layer2DToChar(child->getLayer()),child->getClassName(), child->getName(),
605                  this->getClassName(), this->getName(), Element2D::layer2DToChar(this->layer));
606        child->layer = this->layer;
607        this->children.push_front(child);
608      }
609      else
610      {
611        // Inserting the Element at the right Layer depth.
[7840]612        std::list<Element2D*>::iterator elem;
[7332]613        for (elem = this->children.begin(); elem != this->children.end(); elem++)
614        {
615          if ((*elem)->layer <= child->layer)
616          {
617            this->children.insert(elem, child);
618            break;
619          }
620        }
621        // if we are at the Last child push it back.
622        if (elem == this->children.end())
623          this->children.push_back(child);
624      }
625    }
626    else
627    {
628      PRINTF(1)("Tried to reparent2D to own child '%s::%s' to '%s::%s'.\n",
629                this->getClassName(), this->getName(), child->getClassName(), child->getName());
630      child->parent = NULL;
631    }
[5402]632  }
[6299]633  child->parentCoorChanged2D();
[5081]634}
635
[5091]636/**
637 * @see Element2D::addChild(Element2D* child);
638 * @param childName the name of the child to add to this PNode
639 */
[7221]640void Element2D::addChild2D (const std::string& childName)
[5081]641{
[5082]642  Element2D* childNode = dynamic_cast<Element2D*>(ClassList::getObject(childName, CL_ELEMENT_2D));
643  if (childNode != NULL)
644    this->addChild2D(childNode);
[5081]645}
646
[5091]647/**
[7330]648 * @brief removes a child from the node
[5091]649 * @param child the child to remove from this Node..
650 *
651 * Children from nodes will not be lost, they are referenced to NullPointer
652 */
[5081]653void Element2D::removeChild2D (Element2D* child)
654{
[5212]655  if (child != NULL)
656    child->remove2D();
[5081]657}
658
[5091]659/**
[6299]660 * !! PRIVATE FUNCTION
661 * @brief reparents an Element2D (happens on Parents Node delete or remove and Flags are set.)
662 */
663void Element2D::reparent2D()
664{
665  if (this->parentMode & E2D_REPARENT_TO_NULL)
666    this->setParent2D((Element2D*)NULL);
667  else if (this->parentMode & E2D_REPARENT_TO_PARENTS_PARENT && this->parent != NULL)
668    this->setParent2D(this->parent->getParent2D());
669  else
670    this->setParent2D(Element2D::getNullElement());
671}
672
673
674/**
675 * @param child the child to be erased from this Nodes List
676 */
677void Element2D::eraseChild2D(Element2D* child)
678{
679  assert (this != NULL && child != NULL);
680  std::list<Element2D*>::iterator childIT = std::find(this->children.begin(), this->children.end(), child);
681  this->children.erase(childIT);
682}
683
684
685
686/**
[7840]687 * @brief remove this Element from the tree and adds all children to NullElement2D
[5091]688 *
[5285]689 * afterwards this Node is free, and can be reattached, or deleted freely.
[5091]690 */
[5081]691void Element2D::remove2D()
692{
[7840]693  std::list<Element2D*>::iterator child = this->children.begin();
694  std::list<Element2D*>::iterator reparenter;
[6299]695  while (child != this->children.end())
696  {
697    reparenter = child;
698    child++;
699    if (this->parentMode & E2D_REPARENT_CHILDREN_ON_REMOVE ||
700        (*reparenter)->parentMode & E2D_REPARENT_ON_PARENTS_REMOVE)
701    {
702      (*reparenter)->reparent2D();
[8989]703      PRINTF(5)("REPARENTED TO: %s::%s\n",(*reparenter)->getParent2D()->getClassName(),(*reparenter)->getParent2D()->getName());
[6299]704    }
705  }
[5214]706  if (this->parent != NULL)
[5285]707  {
[6299]708    this->parent->eraseChild2D(this);
[5285]709    this->parent = NULL;
710  }
[5081]711}
712
713
[5091]714/**
715 * @see Element2D::setParent(Element2D* parent);
716 * @param parentName the name of the Parent to set to this Element2D
717 */
[7221]718void Element2D::setParent2D (const std::string& parentName)
[5081]719{
[5082]720  Element2D* parentNode = dynamic_cast<Element2D*>(ClassList::getObject(parentName, CL_ELEMENT_2D));
721  if (parentNode != NULL)
722    parentNode->addChild2D(this);
[6299]723  else
724    PRINTF(2)("Not Found Element2D's (%s::%s) new Parent by Name: %s\n",
[7332]725              this->getClassName(), this->getName(), parentName.c_str());
[5081]726}
727
[5091]728/**
[7840]729 * @brief does the reparenting in a very smooth way
[5091]730 * @param parentNode the new Node to connect this node to.
731 * @param bias the speed to iterate to this new Positions
732 */
[5382]733void Element2D::setParentSoft2D(Element2D* parentNode, float bias)
[5081]734{
[5082]735  if (this->parent == parentNode)
736    return;
737
738  if (likely(this->toCoordinate == NULL))
739  {
[7316]740    this->toCoordinate = new Vector2D();
[5082]741    *this->toCoordinate = this->getRelCoor2D();
742  }
743  if (likely(this->toDirection == NULL))
744  {
745    this->toDirection = new float;
746    *this->toDirection = this->getRelDir2D();
747  }
748  this->bias = bias;
749
750
[7316]751  Vector2D tmpV = this->getAbsCoor2D();
[5082]752  float tmpQ = this->getAbsDir2D();
753
754  parentNode->addChild2D(this);
755
[6299]756  if (this->parentMode & E2D_PARENT_ROTATE_MOVEMENT) //! @todo implement this.
[5082]757    ;//this->setRelCoor(this->parent->getAbsDir().inverse().apply(tmpV - this->parent->getAbsCoor()));
758  else
[5382]759    this->relCoordinate = (tmpV - parentNode->getAbsCoor2D());
760  this->bRelCoorChanged = true;
[5082]761
[5382]762  this->relDirection = (tmpQ - parentNode->getAbsDir2D());
763  this->bRelDirChanged = true;
[5081]764}
765
[5091]766/**
[7330]767 * @brief does the reparenting in a very smooth way
[5091]768 * @param parentName the name of the Parent to reconnect to
769 * @param bias the speed to iterate to this new Positions
770 */
[7221]771void Element2D::setParentSoft2D(const std::string& parentName, float bias)
[5081]772{
[5082]773  Element2D* parentNode = dynamic_cast<Element2D*>(ClassList::getObject(parentName, CL_ELEMENT_2D));
774  if (parentNode != NULL)
[5382]775    this->setParentSoft2D(parentNode, bias);
[5081]776}
777
[6299]778/**
779 * @param parentMode sets the parentingMode of this Node
780 */
781void Element2D::setParentMode2D(E2D_PARENT_MODE parentMode)
[6142]782{
[6307]783  this->parentMode = ((this->parentMode & 0xfff0) | parentMode);
[6142]784}
785
[6299]786
[5091]787/**
[6295]788 * @brief sets the mode of this parent manually
[5091]789 * @param parentMode a String representing this parentingMode
790 */
[7221]791void Element2D::setParentMode2D (const std::string& parentingMode)
[5081]792{
[7221]793  this->setParentMode2D(Element2D::stringToParentingMode2D(parentingMode));
[5081]794}
795
[7330]796/**
797 * @brief checks if elem1 is in a deeper layer as elem2
798 * @param elem1 the first Element2D
799 * @param elem2 the second Element2D
800 * @returns true if elem1->layer < elem2->layer
801 */
802bool Element2D::layerSortPredicate(const Element2D* elem1, const Element2D* elem2)
803{
804  return elem1->layer < elem2->layer;
805}
[6299]806
[7330]807
[5091]808/**
[6299]809 * @returns the NullElement (and if needed (most probably) creates it)
810 */
811Element2D* Element2D::createNullElement()
812{
813  if (likely(Element2D::nullElement == NULL))
814  {
815    Element2D::nullElement = new Element2D(NULL, E2D_LAYER_BELOW_ALL, E2D_PARENT_MODE_DEFAULT | E2D_REPARENT_TO_NULL);
816    Element2D::nullElement->setName("NullElement");
817  }
818  return Element2D::nullElement;
819}
820
821
822/**
823 * !! PRIVATE FUNCTION
824 * @brief checks the upward integrity (e.g if Element2D is somewhere up the Node tree.)
825 * @param checkParent the Parent to check.
826 * @returns true if the integrity-check succeeds, false otherwise.
827 *
828 * If there is a second occurence of checkParent before NULL, then a loop could get
829 * into the Tree, and we do not want this.
830 */
831bool Element2D::checkIntegrity(const Element2D* checkParent) const
832{
833  const Element2D* parent = this;
834  while ( (parent = parent->getParent2D()) != NULL)
835    if (unlikely(parent == checkParent))
836      return false;
837  return true;
838}
839
840
841/**
[7330]842 * @brief updates the absCoordinate/absDirection
[5091]843 * @param dt The time passed since the last update
[5081]844
[5091]845   this is used to go through the parent-tree to update all the absolute coordinates
846   and directions. this update should be done by the engine, so you don't have to
847   worry, normaly...
848 */
[5081]849void Element2D::update2D (float dt)
850{
[5089]851  // setting the Position of this 2D-Element.
[5083]852  if( likely(this->parent != NULL))
853  {
[7332]854    // movement for nodes with smoothMove enabled
[5083]855    if (unlikely(this->toCoordinate != NULL))
856    {
[7316]857      Vector2D moveVect = (*this->toCoordinate - this->relCoordinate) *fabsf(dt)*bias;
[5082]858
[5083]859      if (likely(moveVect.len() >= .001))//PNODE_ITERATION_DELTA))
860      {
861        this->shiftCoor2D(moveVect);
862      }
863      else
864      {
[7316]865        Vector2D tmp = *this->toCoordinate;
[5377]866        this->setRelCoor2D(tmp);
[5083]867        PRINTF(5)("SmoothMove of %s finished\n", this->getName());
868      }
869    }
870    if (unlikely(this->toDirection != NULL))
871    {
[5376]872      float rotFlot = (*this->toDirection - this->relDirection) *fabsf(dt)*bias;
873      if (likely(fabsf(rotFlot) >= .001))//PNODE_ITERATION_DELTA))
[5083]874      {
875        this->shiftDir2D(rotFlot);
876      }
877      else
878      {
[5377]879        float tmp = *this->toDirection;
880        this->setRelDir2D(tmp);
[5083]881        PRINTF(5)("SmoothRotate of %s finished\n", this->getName());
882      }
883    }
[7031]884    if (unlikely(this->toSize != NULL))
885    {
[7919]886      Vector2D shiftSize = (*this->toSize - this->size) *fabsf(dt)*bias;
[7031]887      if (likely((shiftSize).len() >= .001))//PNODE_ITERATION_DELTA))
888      {
[7919]889        this->size += shiftSize;
[7031]890      }
891      else
892      {
893        delete this->toSize;
894        this->toSize = NULL;
895        PRINTF(5)("SmoothRotate of %s finished\n", this->getName());
896      }
897    }
[5083]898
899    // MAIN UPDATE /////////////////////////////////////
900    this->lastAbsCoordinate = this->absCoordinate;
901
[7316]902    PRINTF(5)("Element2D::update - %s - (%f, %f)\n", this->getName(), this->absCoordinate.x, this->absCoordinate.y);
[5083]903
904
[5118]905    if( this->parentMode & E2D_PARENT_LOCAL_ROTATE && this->bRelDirChanged)
[5083]906    {
907      /* update the current absDirection - remember * means rotation around sth.*/
[5090]908      this->prevRelDirection = this->relDirection;
[5083]909      this->absDirection = this->relDirection + parent->getAbsDir2D();;
910    }
911
[5089]912
[5397]913    if (unlikely(this->alignment & E2D_ALIGN_SCREEN_CENTER && this->bRelCoorChanged))
[5083]914    {
915      this->prevRelCoordinate = this->relCoordinate;
[5089]916      this->absCoordinate.x = .5 + this->relCoordinate.x;
917      this->absCoordinate.y = .5 + this->relCoordinate.y;
[5083]918    }
[5397]919    else if (unlikely(this->bindNode != NULL))
[5083]920    {
[7843]921      if (State::getCamera()->distance(this->bindNode) < 0)
922        this->bCurrentlyVisible = false;
923      else
924      {
925        this->bCurrentlyVisible = true;
926      }
927
[7871]928      /// TODO this should be done on the new Projection Matrix.
[6778]929      GLdouble projectPos[3] = {0.0, 0.0, 0.0};
[5089]930      gluProject(this->bindNode->getAbsCoor().x,
931                 this->bindNode->getAbsCoor().y,
932                 this->bindNode->getAbsCoor().z,
933                 GraphicsEngine::modMat,
934                 GraphicsEngine::projMat,
935                 GraphicsEngine::viewPort,
936                 projectPos,
937                 projectPos+1,
938                 projectPos+2);
[7332]939      //       printf("%s::%s  == %f %f %f :: %f %f\n", this->getClassName(), this->getName(),
940      //              this->bindNode->getAbsCoor().x,
941      //              this->bindNode->getAbsCoor().y,
942      //              this->bindNode->getAbsCoor().z,
943      //              projectPos[0],
944      //              projectPos[1]);
[6778]945
[5396]946      this->prevRelCoordinate.x = this->absCoordinate.x = projectPos[0] /* /(float)GraphicsEngine::getInstance()->getResolutionX() */ + this->relCoordinate.x;
947      this->prevRelCoordinate.y = this->absCoordinate.y = (float)GraphicsEngine::getInstance()->getResolutionY() -  projectPos[1] + this->relCoordinate.y;
948      this->bRelCoorChanged = true;
[5089]949    }
950    else
951    {
952      if(likely(this->parentMode & PNODE_MOVEMENT && this->bRelCoorChanged))
953      {
954        /* update the current absCoordinate */
955        this->prevRelCoordinate = this->relCoordinate;
956        this->absCoordinate = this->parent->getAbsCoor2D() + this->relCoordinate;
957      }
958      else if( this->parentMode & PNODE_ROTATE_MOVEMENT && this->bRelCoorChanged)
959      {
960        /* update the current absCoordinate */
961        this->prevRelCoordinate = this->relCoordinate;
[8316]962//         float sine = sin(this->parent->getAbsDir2D());
963//         float cose = cos(this->parent->getAbsDir2D());
[7332]964        //        this->absCoordinate.x = this->relCoordinate.x*cose - this->relCoordinate.y*sine + this->parent->getRelCoor2D().x*(1-cose) +this->parent->getRelCoor2D().y*sine;
965        //        this->absCoordinate.y = this->relCoordinate.x*sine + this->relCoordinate.y*cose + this->parent->getRelCoor2D().y*(1-cose) +this->parent->getRelCoor2D().x*sine;
[5090]966
[5089]967        this->absCoordinate.x = this->parent->getAbsCoor2D().x + (this->relCoordinate.x*cos(this->parent->getAbsDir2D()) - this->relCoordinate.y * sin(this->parent->getAbsDir2D()));
968        this->absCoordinate.y = this->parent->getAbsCoor2D().y + (this->relCoordinate.x*sin(this->parent->getAbsDir2D()) + this->relCoordinate.y * cos(this->parent->getAbsDir2D()));
[5083]969
[5089]970      }
[5083]971    }
972    /////////////////////////////////////////////////
973  }
974  else
975  {
[7316]976    PRINTF(5)("Element2D::update - (%f, %f)\n", this->absCoordinate.x, this->absCoordinate.y);
[5083]977    if (this->bRelCoorChanged)
[5118]978    {
979      this->prevRelCoordinate = this->relCoordinate;
[5083]980      this->absCoordinate = this->relCoordinate;
[5118]981    }
[5083]982    if (this->bRelDirChanged)
[5118]983    {
984      this->prevRelDirection = this->relDirection;
[5376]985      this->absDirection = this->getAbsDir2D() + this->relDirection;
[5118]986    }
[5083]987  }
988
[5089]989
990  // UPDATE CHILDREN
[6299]991  if(!this->children.empty() || this->parentMode & E2D_UPDATE_CHILDREN_IF_INACTIVE)
[5083]992  {
[7840]993    std::list<Element2D*>::iterator child;
[5775]994    for (child = this->children.begin(); child != this->children.end(); child++)
[5083]995    {
996      /* if this node has changed, make sure, that all children are updated also */
997      if( likely(this->bRelCoorChanged))
[6299]998        (*child)->parentCoorChanged2D();
[5083]999      if( likely(this->bRelDirChanged))
[6299]1000        (*child)->parentDirChanged2D();
[5083]1001
[5775]1002      (*child)->update2D(dt);
[5083]1003    }
1004  }
[5089]1005
1006  // FINISHING PROCESS
[5083]1007  this->velocity = (this->absCoordinate - this->lastAbsCoordinate) / dt;
1008  this->bRelCoorChanged = false;
1009  this->bRelDirChanged = false;
[5081]1010}
1011
[6299]1012
[5091]1013/**
[7840]1014 * @brief displays some information about this pNode
[5091]1015 * @param depth The deph into which to debug the children of this Element2D to.
1016 * (0: all children will be debugged, 1: only this Element2D, 2: this and direct children...)
1017 * @param level The n-th level of the Node we draw (this is internal and only for nice output)
1018 */
[7052]1019void Element2D::debug2D (unsigned int depth, unsigned int level) const
[5081]1020{
[5082]1021  for (unsigned int i = 0; i < level; i++)
1022    PRINT(0)(" |");
[5775]1023  if (this->children.size() > 0)
[5082]1024    PRINT(0)(" +");
1025  else
1026    PRINT(0)(" -");
[7332]1027  PRINT(0)("E2D(%s::%s);AC:(%0.2f, %0.2f);RC:(%0.2f, %0.2f);AD(%0.2f)->%s;Layer:(%s)\n",
1028           this->getClassName(),
1029           this->getName(),
1030           this->absCoordinate.x,
1031           this->absCoordinate.y,
1032           this->relCoordinate.x,
1033           this->relCoordinate.y,
1034           this->getAbsDir2D(),
1035           Element2D::parentingModeToString2D(parentMode),
1036           Element2D::layer2DToChar(this->layer));
[5402]1037
[5082]1038  if (depth >= 2 || depth == 0)
1039  {
[7840]1040    std::list<Element2D*>::const_iterator child;
[5775]1041    for (child = this->children.begin(); child != this->children.end(); child++)
[5082]1042    {
1043      if (depth == 0)
[7052]1044        (*child)->debug2D(0, level + 1);
[5082]1045      else
[7052]1046        (*child)->debug2D(depth - 1, level +1);
[5082]1047    }
1048  }
[5081]1049}
1050
[5285]1051/**
[7840]1052 * @brief ticks the 2d-Element
[5285]1053 * @param dt the time elapsed since the last tick
[5401]1054 *
1055 * the element only gets tickt, if it is active.
1056 * Be aware, that this walks through the entire Element2D-tree,
1057 * searching for Elements to be ticked.
[5285]1058 */
[5401]1059void Element2D::tick2D(float dt)
[5285]1060{
[6299]1061  if (this->bActive)
[5401]1062    this->tick(dt);
[5775]1063  if (this->children.size() > 0)
[5401]1064  {
[7840]1065    std::list<Element2D*>::iterator child;
[5775]1066    for (child = this->children.begin(); child != this->children.end(); child++)
1067      (*child)->tick2D(dt);
[5401]1068  }
1069}
[5082]1070
[5401]1071/**
[7840]1072 * @brief draws all the Elements from this element2D downwards
[8360]1073 * @param from the minimal Layer to draw. @see E2D_LAYER
1074 * @param to the maximal Layer to draw. @see E2D_LAYER
1075 *
[5401]1076 */
[7840]1077void Element2D::draw2D(E2D_LAYER from, E2D_LAYER to) const
[5401]1078{
[7844]1079  if (this->isVisible())
[8360]1080  {
[5401]1081    this->draw();
[8360]1082    this->drawChildren(from, to);
1083  }
1084  else if ((parentMode & E2D_HIDE_CHILDREN_IF_HIDDEN) == 0)
1085    this->drawChildren(from, to);
1086}
1087
1088/**
1089 * @brief Draws the Children of the Element2D node.
1090 * @param param the minimal Layer to draw. @see E2D_LAYER
1091 * @param to the maximal Layer to draw. @see E2D_LAYER
1092 */
1093void Element2D::drawChildren(E2D_LAYER from, E2D_LAYER to) const
1094{
1095  if (likely(this->children.size() > 0))
[5401]1096  {
[7840]1097    std::list<Element2D*>::const_iterator child;
[5775]1098    for (child = this->children.begin(); child != this->children.end(); child++)
[7840]1099      if (likely( (*child)->layer >= from && (*child)->layer <= to))
1100        (*child)->draw2D(from, to);
[5401]1101  }
[5285]1102}
1103
[8360]1104
[5091]1105/**
[7330]1106 * @brief displays the Element2D at its position with its rotation as a Plane.
[5091]1107 */
[5417]1108void Element2D::debugDraw2D(unsigned int depth, float size, Vector color, unsigned int level) const
[5081]1109{
[5417]1110  if (level == 0)
1111  {
1112    glPushAttrib(GL_ENABLE_BIT);
1113    glMatrixMode(GL_MODELVIEW);
[5082]1114
[5417]1115    glDisable(GL_LIGHTING);
1116    glDisable(GL_BLEND);
1117    glDisable(GL_TEXTURE_2D);
1118  }
1119
1120  glPushMatrix();
1121  /* translate */
1122  /* rotate */
1123  glColor3f(color.x, color.y, color.z);
1124
1125  glTranslatef (this->getAbsCoor2D().x, this->getAbsCoor2D().y, 0);
1126  glRotatef(this->getAbsDir2D(), 0,0,1);
1127  glBegin(GL_LINE_LOOP);
[5418]1128  glVertex2f(0, 0);
1129  glVertex2f(0, +this->getSizeY2D());
[5417]1130  glVertex2f(+this->getSizeX2D(), +this->getSizeY2D());
[5418]1131  glVertex2f(+this->getSizeX2D(), 0);
[5417]1132  glEnd();
1133
1134
1135  glPopMatrix();
1136  if (depth >= 2 || depth == 0)
1137  {
1138    Vector childColor =  Color::HSVtoRGB(Color::RGBtoHSV(color)+Vector(20,0,.0));
[7840]1139    std::list<Element2D*>::const_iterator child;
[5775]1140    for (child = this->children.begin(); child != this->children.end(); child++)
[5417]1141    {
1142      // drawing the Dependency graph
[6299]1143      if (this != Element2D::getNullElement())
[5417]1144      {
1145        glBegin(GL_LINES);
1146        glColor3f(color.x, color.y, color.z);
1147        glVertex3f(this->getAbsCoor2D ().x,
1148                   this->getAbsCoor2D ().y,
1149                   0);
1150        glColor3f(childColor.x, childColor.y, childColor.z);
[5775]1151        glVertex3f((*child)->getAbsCoor2D ().x,
1152                   (*child)->getAbsCoor2D ().y,
[5417]1153                   0);
1154        glEnd();
1155      }
1156      if (depth == 0)
[5775]1157        (*child)->debugDraw2D(0, size, childColor, level+1);
[5417]1158      else
[5775]1159        (*child)->debugDraw2D(depth - 1, size, childColor, level +1);
[5417]1160    }
1161  }
1162  if (level == 0)
1163    glPopAttrib();
[5081]1164}
1165
1166
1167// helper functions //
[5091]1168/**
[7330]1169 * @brief converts a parentingMode into a string that is the name of it
[5091]1170 * @param parentingMode the ParentingMode to convert
1171 * @return the converted string
1172 */
[7221]1173const char* Element2D::parentingModeToString2D(int parentingMode)
[5081]1174{
[5082]1175  if (parentingMode == E2D_PARENT_LOCAL_ROTATE)
1176    return "local-rotate";
1177  else if (parentingMode == E2D_PARENT_ROTATE_MOVEMENT)
1178    return "rotate-movement";
1179  else if (parentingMode == E2D_PARENT_MOVEMENT)
1180    return "movement";
1181  else if (parentingMode == E2D_PARENT_ALL)
1182    return "all";
1183  else if (parentingMode == E2D_PARENT_ROTATE_AND_MOVE)
1184    return "rotate-and-move";
[8316]1185  else return "all";
[5081]1186}
1187
[5091]1188/**
[7330]1189 * @brief converts a parenting-mode-string into a int
[5091]1190 * @param parentingMode the string naming the parentingMode
1191 * @return the int corresponding to the named parentingMode
1192 */
[7221]1193E2D_PARENT_MODE Element2D::stringToParentingMode2D(const std::string& parentingMode)
[5081]1194{
[7221]1195  if (parentingMode == "local-rotate")
[5082]1196    return (E2D_PARENT_LOCAL_ROTATE);
[7221]1197  else  if (parentingMode == "rotate-movement")
[5082]1198    return (E2D_PARENT_ROTATE_MOVEMENT);
[7221]1199  else  if (parentingMode == "movement")
[5082]1200    return (E2D_PARENT_MOVEMENT);
[7221]1201  else  if (parentingMode == "all")
[5082]1202    return (E2D_PARENT_ALL);
[7221]1203  else  if (parentingMode == "rotate-and-move")
[5082]1204    return (E2D_PARENT_ROTATE_AND_MOVE);
[8316]1205  else return E2D_PARENT_ALL;
[5081]1206}
1207
[5401]1208/**
[7330]1209 * @brief converts a layer into its corresponding string
[5401]1210 * @param layer the layer to get the name-String of.
1211 * @returns the Name of the Layer (on error the default-layer-string is returned)
1212 */
1213const char* Element2D::layer2DToChar(E2D_LAYER layer)
1214{
1215  switch(layer)
1216  {
[7330]1217    case E2D_LAYER_ABOVE_ALL:
1218      return "above-all";
[5401]1219    case E2D_LAYER_TOP:
1220      return "top";
1221    case E2D_LAYER_MEDIUM:
1222      return "medium";
1223    case E2D_LAYER_BOTTOM:
1224      return "bottom";
1225    case E2D_LAYER_BELOW_ALL:
1226      return "below-all";
1227    default:
[7330]1228      assert (false);
[5401]1229      return layer2DToChar(E2D_DEFAULT_LAYER);
1230  }
1231}
[5081]1232
[5401]1233/**
[7330]1234 * @brief converts a String holding a actual Layer
[5401]1235 * @param layer the String to convert into a Layer2D
1236 * @returns the E2D_LAYER on success, E2D_DEFAULT_LAYER on error.
1237 */
[7221]1238E2D_LAYER Element2D::charToLayer2D(const std::string& layer)
[5401]1239{
[7330]1240  if (layer == "above-all")
1241    return (E2D_LAYER_ABOVE_ALL);
1242  if (layer == "top")
[5401]1243    return (E2D_LAYER_TOP);
[7221]1244  else  if (layer == "medium")
[5401]1245    return (E2D_LAYER_MEDIUM);
[7221]1246  else  if (layer == "bottom")
[5401]1247    return (E2D_LAYER_BOTTOM);
[7221]1248  else  if (layer == "below-all")
[5401]1249    return (E2D_LAYER_BELOW_ALL);
1250  else
1251    return (E2D_DEFAULT_LAYER);
1252}
Note: See TracBrowser for help on using the repository browser.