Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/trunk/src/orxonox/core/BaseObject.h @ 1052

Last change on this file since 1052 was 1052, checked in by landauf, 16 years ago

merged core2 back to trunk
there might be some errors, wasn't able to test it yet due to some strange g++ and linker behaviour.

File size: 4.7 KB
Line 
1/*
2 *   ORXONOX - the hottest 3D action shooter ever to exist
3 *
4 *
5 *   License notice:
6 *
7 *   This program is free software; you can redistribute it and/or
8 *   modify it under the terms of the GNU General Public License
9 *   as published by the Free Software Foundation; either version 2
10 *   of the License, or (at your option) any later version.
11 *
12 *   This program is distributed in the hope that it will be useful,
13 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
14 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 *   GNU General Public License for more details.
16 *
17 *   You should have received a copy of the GNU General Public License
18 *   along with this program; if not, write to the Free Software
19 *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
20 *
21 *   Author:
22 *      Fabian 'x3n' Landau
23 *   Co-authors:
24 *      ...
25 *
26 */
27
28/**
29    @file BaseObject.h
30    @brief Definition of the BaseObject class.
31
32    The BaseObject is the parent of all classes representing an instance in the game.
33*/
34
35#ifndef _BaseObject_H__
36#define _BaseObject_H__
37
38#include "CorePrereqs.h"
39#include "util/XMLIncludes.h"
40
41#include "OrxonoxClass.h"
42
43namespace orxonox
44{
45    //! The BaseObject is the parent of all classes representing an instance in the game.
46    class _CoreExport BaseObject : virtual public OrxonoxClass
47    {
48        public:
49            BaseObject();
50            virtual ~BaseObject();
51            virtual void loadParams(TiXmlElement* xmlElem);
52            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
53
54            /** @brief Sets the name of the object. @param name The name */
55            inline void setName(const std::string& name) { this->name_ = name; this->changedName(); }
56            /** @brief Returns the name of the object. @return The name */
57            inline const std::string& getName() const { return this->name_; }
58            /** @brief This function gets called if the name of the object changes. */
59            virtual void changedName() {}
60
61            /** @brief Sets the state of the objects activity. @param bActive True = active */
62            inline void setActivity(bool bActive) { this->bActive_ = bActive; this->changedActivity(); }
63            /** @brief Returns the state of the objects activity. @return The state of the activity */
64            inline const bool isActive() const { return this->bActive_; }
65            /** @brief This function gets called if the activity of the object changes. */
66            virtual void changedActivity() {}
67
68            /** @brief Sets the state of the objects visibility. @param bVisible True = visible */
69            inline void setVisibility(bool bVisible) { this->bVisible_ = bVisible; this->changedVisibility(); }
70            /** @brief Returns the state of the objects visibility. @return The state of the visibility */
71            inline const bool isVisible() const { return this->bVisible_; }
72            /** @brief This function gets called if the visibility of the object changes. */
73            virtual void changedVisibility() {}
74
75            /** @brief Sets a pointer to the level that loaded this object. @param level The pointer to the level */
76            inline void setLevel(const Level* level) { this->level_ = level; }
77            /** @brief Returns a pointer to the level that loaded this object. @return The level */
78            inline const Level* getLevel() const { return this->level_; }
79            const std::string& getLevelfile() const;
80
81            virtual inline void setNamespace(Namespace* ns) { this->namespace_ = ns; }
82            inline Namespace* getNamespace() const { return this->namespace_; }
83
84            /** @brief Sets the indentation of the debug output in the Loader. @param indentation The indentation */
85            inline void setLoaderIndentation(const std::string& indentation) { this->loaderIndentation_ = indentation; }
86            /** @brief Returns the indentation of the debug output in the Loader. @return The indentation */
87            inline const std::string& getLoaderIndentation() const { return this->loaderIndentation_; }
88
89        private:
90            std::string name_;                          //!< The name of the object
91            bool bActive_;                              //!< True = the object is active
92            bool bVisible_;                             //!< True = the object is visible
93            const Level* level_;                        //!< The level that loaded this object
94            std::string loaderIndentation_;             //!< Indentation of the debug output in the Loader
95            Namespace* namespace_;
96    };
97}
98
99#endif /* _BaseObject_H__ */
Note: See TracBrowser for help on using the repository browser.