Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/core/src/orxonox/core/BaseObject.h @ 847

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

new loader-concept is taking shape, but not yet finished

added new classes: Functor, Executor and XMLPortParamContainer.
more to come (i.e. XMLPortObjectContainer)

Executor might be useless, depends on how we'll implement the ingame shell-commands and the keybindings

moved all non-identifier-related functions and variables from OrxonoxClass to BaseObject. this might result in some casts to BaseObject when working with all objects of an interface (like Synchronisable), but I think it improves the class hierarchy.

File size: 3.9 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 "CoreIncludes.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 Element& XMLPort(Element& xmlelement, bool loading);
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
80        private:
81            std::string name_;                          //!< The name of the object
82            bool bActive_;                              //!< True = the object is active
83            bool bVisible_;                             //!< True = the object is visible
84            const Level* level_;                        //!< The level that loaded this object
85    };
86}
87
88#endif /* _BaseObject_H__ */
Note: See TracBrowser for help on using the repository browser.