1 | |
---|
2 | |
---|
3 | /* |
---|
4 | orxonox - the future of 3D-vertical-scrollers |
---|
5 | |
---|
6 | Copyright (C) 2004 orx |
---|
7 | |
---|
8 | This program is free software; you can redistribute it and/or modify |
---|
9 | it under the terms of the GNU General Public License as published by |
---|
10 | the Free Software Foundation; either version 2, or (at your option) |
---|
11 | any later version. |
---|
12 | |
---|
13 | ### File Specific: |
---|
14 | main-programmer: Patrick Boenzli |
---|
15 | co-programmer: ... |
---|
16 | */ |
---|
17 | |
---|
18 | |
---|
19 | #include "null_parent.h" |
---|
20 | |
---|
21 | |
---|
22 | using namespace std; |
---|
23 | |
---|
24 | |
---|
25 | /** |
---|
26 | \brief standard constructor |
---|
27 | |
---|
28 | \todo this constructor is not jet implemented - do it |
---|
29 | */ |
---|
30 | NullParent::NullParent () |
---|
31 | { |
---|
32 | this->parent = this; |
---|
33 | this->mode = ALL; |
---|
34 | } |
---|
35 | |
---|
36 | |
---|
37 | NullParent::NullParent (Vector* absCoordinate) |
---|
38 | { |
---|
39 | this->parent = this; |
---|
40 | this->mode = ALL; |
---|
41 | this->absCoordinate = *absCoordinate; |
---|
42 | } |
---|
43 | |
---|
44 | |
---|
45 | /** |
---|
46 | \brief standard deconstructor |
---|
47 | |
---|
48 | \todo this deconstructor is not jet implemented - do it |
---|
49 | */ |
---|
50 | NullParent::~NullParent () {} |
---|
51 | |
---|
52 | |
---|
53 | |
---|
54 | |
---|
55 | /** |
---|
56 | \brief updates the absCoordinate/absDirection |
---|
57 | |
---|
58 | this is used to go through the parent-tree to update all the absolute coordinates |
---|
59 | and directions. this update should be done by the engine, so you don't have to |
---|
60 | worry, normaly... |
---|
61 | */ |
---|
62 | void NullParent::update (long timeStamp) |
---|
63 | { |
---|
64 | this->absCoordinate = this->relCoordinate; |
---|
65 | this->absDirection = parent->getAbsDir () * this->relDirection; |
---|
66 | |
---|
67 | |
---|
68 | PNode* pn = this->children->enumerate (); |
---|
69 | while( pn != NULL) |
---|
70 | { |
---|
71 | /* if this node has changed, make sure, that all children are updated also */ |
---|
72 | if( this->bRelCoorChanged || this->bAbsCoorChanged) |
---|
73 | pn->parentCoorChanged (); |
---|
74 | if( this->bRelDirChanged || this->bAbsDirChanged) |
---|
75 | pn->parentDirChanged (); |
---|
76 | pn->update (timeStamp); |
---|
77 | pn = this->children->nextElement (); |
---|
78 | } |
---|
79 | |
---|
80 | this->timeStamp = timeStamp; |
---|
81 | this->bRelCoorChanged = false; |
---|
82 | this->bAbsCoorChanged = false; |
---|
83 | this->bRelDirChanged = false; |
---|
84 | this->bAbsDirChanged = false; |
---|
85 | } |
---|