~ubuntu-branches/debian/sid/ember/sid

« back to all changes in this revision

Viewing changes to src/components/ogre/terrain/TerrainArea.h

  • Committer: Bazaar Package Importer
  • Author(s): Michael Koch
  • Date: 2009-10-22 23:21:17 UTC
  • mfrom: (1.1.1 upstream) (2.1.1 sid)
  • Revision ID: james.westby@ubuntu.com-20091022232117-isr8u3402qmu7ilo
Tags: 0.5.7-1
* New upstream release.
  - Compile against current ogre (Closes: #551431)
  - Removed debian/patches/ember-gcc4.4.patch. Merged upstream.
  - Updated Depends on ember-media.
* Add libboost-thread-dev tp Build-Depends.
* Make debian/rules independent from upstream version.
* Updated watch file to allow automatic download of new upstream
  tarballs.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
//
2
2
// C++ Interface: TerrainArea
3
3
//
4
 
// Description: 
 
4
// Description:
5
5
//
6
6
//
7
7
// Author: Erik Hjortsberg <erik.hjortsberg@gmail.com>, (C) 2005
10
10
// it under the terms of the GNU General Public License as published by
11
11
// the Free Software Foundation; either version 2 of the License, or
12
12
// (at your option) any later version.
13
 
// 
 
13
//
14
14
// This program is distributed in the hope that it will be useful,
15
15
// but WITHOUT ANY WARRANTY; without even the implied warranty of
16
16
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17
17
// GNU General Public License for more details.
18
 
// 
 
18
//
19
19
// You should have received a copy of the GNU General Public License
20
20
// along with this program; if not, write to the Free Software
21
21
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.//
49
49
class TerrainArea : public virtual sigc::trackable
50
50
{
51
51
public:
52
 
        
 
52
 
53
53
        /**
54
54
                * @brief Ctor.
55
55
                * You must make sure to call init() after you've created your TerrainArea instance, to properly set it up.
56
56
                * @param entity The entity to wich this area is connected. This cannot be null, since the definition of the area is kept within the Entity. When the entity moves, the area will be updated.
57
57
                */
58
 
        TerrainArea(EmberEntity* entity);
59
 
        
 
58
        TerrainArea(EmberEntity& entity);
 
59
 
60
60
        /**
61
61
                * @brief Dtor, will delete the allocated Mercator::Area.
62
62
                */
63
63
        ~TerrainArea();
64
 
    
 
64
 
65
65
        /**
66
66
         * @brief Sets up the observation of the entity, and parses the area info, creating the initial area instance.
67
67
         * @return True if the atlas data was conformant and successfully parsed.
68
68
         */
69
69
        bool init();
70
 
        
 
70
 
71
71
        /**
72
72
         * @brief Accessor for the Mercator::Area, which is the Mercator representation of the area. We shouldn't do very much ourselves with this, instead passing it on to Mercator::Terrain in most cases.
73
73
         * @return The Mercator::Area instance for this terrain area, or null if none could be created.
74
74
         */
75
75
        Mercator::Area* getArea() const;
76
 
        
 
76
 
77
77
        /**
78
78
         * @brief Setter for the Mercator::Area instance for this terrain area.
79
79
         * Normally you would never call this, instead depending on the parsing of the terrain area from the atlas data, through parseArea().
80
80
         * @param area The new Mercator::Area instance.
81
81
         */
82
82
        void setArea(Mercator::Area* area);
83
 
        
 
83
 
84
84
        /**
85
85
        @brief Emitted when something about the area changes, and we need to tell the terrain to regenerate the visualization of it.
86
86
        */
90
90
        @brief Emitted when the area is about to be removed, and we need to tell the terrain to regenerate the visualization of it.
91
91
        */
92
92
        sigc::signal<void> EventAreaRemoved;
93
 
        
94
 
        
 
93
 
 
94
 
95
95
        /**
96
96
        @brief Emitted when the underlying terrain area was swapped since it had it's layer changed. Currently the system can't handle dynamic changing of the layer, so we need to create a new area and drop the old one when the layer is changed.
97
97
        */
98
98
        sigc::signal<void, Mercator::Area&> EventAreaSwapped;
99
 
        
 
99
 
100
100
 
101
101
protected:
102
102
 
104
104
        @brief The internal Mercator::Area instance which this class wraps.
105
105
        */
106
106
        Mercator::Area* mArea;
107
 
        
 
107
 
108
108
        /**
109
109
        @brief An internal Mercator::Area instance used to hold a temporary instance when the area needs to be swapped.
110
110
        */
111
111
        Mercator::Area* mOldArea;
112
 
        
 
112
 
113
113
        /**
114
114
        @brief The entity to which this area is connected to.
115
115
        */
116
 
        EmberEntity* mEntity;
117
 
        
 
116
        EmberEntity& mEntity;
 
117
 
118
118
        /**
119
119
        @brief The slot we use for listening to attribute changes in the entity. Mainly used to listen for changes to the "area" attribute, since that's the one which defined the area.
120
120
        */
121
121
        Eris::Entity::AttrChangedSlot mAttrChangedSlot;
122
 
        
 
122
 
123
123
        /**
124
124
         * @brief When the "area" attribute of the entity to which the terrain area belongs to changes we need to emit the EventAreaChanged signal. This method will take care of that.
125
125
         * @param attributeValue The attribute which was changed.
126
126
         */
127
127
        void attributeChanged(const Atlas::Message::Element& attributeValue);
128
 
        
 
128
 
129
129
        /**
130
130
         * @brief Called when the entity moves, at which point we need to update the area.
131
131
         */
132
132
        void entity_Moved();
133
 
        
 
133
 
134
134
        /**
135
135
         * @brief Initializes the observation of the entity, setting up listeners.
136
136
         */
137
137
        void observeEntity();
138
 
        
 
138
 
139
139
        /**
140
140
         * @brief Parses the Atlas data looking for area definitions.
141
141
         * If no Mercator::Area instance has been created, one will be created here. If however there's alreay an existing area it will be updated.
142
 
         * @return 
 
142
         * @return
143
143
         */
144
144
        bool parseArea();
145
145
 
146
146
};
147
147
 
148
 
inline Mercator::Area* TerrainArea::getArea() const 
 
148
inline Mercator::Area* TerrainArea::getArea() const
149
149
{
150
 
        return mArea; 
 
150
        return mArea;
151
151
}
152
 
inline void TerrainArea::setArea(Mercator::Area* area) 
153
 
154
 
        mArea = area; 
 
152
inline void TerrainArea::setArea(Mercator::Area* area)
 
153
{
 
154
        mArea = area;
155
155
}
156
156
 
157
157
}