Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/objecthierarchy2/src/orxonox/objects/worldentities/Backlight.h @ 2462

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

Added TimeFactorListener to properly handle changes of the global time factor (makes the game faster or slower). Currently supported in Backlight, ParticleInterface and Timer, which were all critical classes I could think of (all other classes are already covered by the adjustment of dt in tick(dt)). It seems to work well, both with small values (0.1, 0.01) and great values (10, 100). Even pausing the game (0) works fine.

  • Property svn:eol-style set to native
  • Property svn:mergeinfo set to (toggle deleted branches)
    /code/branches/ceguilua/src/orxonox/objects/Backlight.h1802-1808
    /code/branches/core3/src/orxonox/objects/Backlight.h1572-1739
    /code/branches/gcc43/src/orxonox/objects/Backlight.h1580
    /code/branches/gui/src/orxonox/objects/Backlight.h1635-1723
    /code/branches/input/src/orxonox/objects/Backlight.h1629-1636
    /code/branches/objecthierarchy/src/orxonox/objects/worldentities/Backlight.h2100,​2110-2169
    /code/branches/script_trigger/src/orxonox/objects/Backlight.h1295-1953,​1955
File size: 3.4 KB
Line 
1/*
2 *   ORXONOX - the hottest 3D action shooter ever to exist
3 *                    > www.orxonox.net <
4 *
5 *
6 *   License notice:
7 *
8 *   This program is free software; you can redistribute it and/or
9 *   modify it under the terms of the GNU General Public License
10 *   as published by the Free Software Foundation; either version 2
11 *   of the License, or (at your option) any later version.
12 *
13 *   This program is distributed in the hope that it will be useful,
14 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
15 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16 *   GNU General Public License for more details.
17 *
18 *   You should have received a copy of the GNU General Public License
19 *   along with this program; if not, write to the Free Software
20 *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
21 *
22 *   Author:
23 *      Fabian 'x3n' Landau
24 *   Co-authors:
25 *      ...
26 *
27 */
28
29#ifndef _Backlight_H__
30#define _Backlight_H__
31
32#include "OrxonoxPrereqs.h"
33#include "FadingBillboard.h"
34#include "gamestates/GSRoot.h"
35
36namespace orxonox
37{
38    class _OrxonoxExport Backlight : public FadingBillboard, public TimeFactorListener
39    {
40        public:
41            Backlight(BaseObject* creator);
42            virtual ~Backlight();
43
44            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
45            void registerVariables();
46
47            virtual void tick(float dt);
48            virtual void changedVisibility();
49
50            inline void setWidth(float width)
51                { this->width_ = width; this->update_width(); }
52            inline float getWidth() const
53                { return this->width_; }
54
55            inline void setLifetime(float lifetime)
56                { this->lifetime_ = lifetime; this->update_lifetime(); }
57            inline float getLifetime() const
58                { return this->lifetime_; }
59
60            inline void setLength(float length)
61                { this->length_ = length; this->update_length(); }
62            inline float getLength() const
63                { return this->length_; }
64
65            inline void setMaxElements(size_t maxelements)
66                { this->maxelements_ = maxelements; this->update_maxelements(); }
67            inline size_t getMaxElements() const
68                { return this->maxelements_; }
69
70            inline void setTrailMaterial(const std::string& material)
71                { this->trailmaterial_ = material; this->update_trailmaterial(); }
72            inline const std::string& getTrailMaterial() const
73                { return this->trailmaterial_; }
74
75            virtual void changedScale();
76
77        protected:
78            virtual void changedTimeFactor(float factor_new, float factor_old);
79
80        private:
81            virtual void startturnonoff();
82            virtual void stopturnonoff();
83            virtual void poststopturnonoff();
84            virtual void changedColour();
85            void update_width();
86            void update_lifetime();
87            void update_length();
88            void update_maxelements();
89            void update_trailmaterial();
90
91            Ogre::RibbonTrail* ribbonTrail_;
92            Ogre::SceneNode* ribbonTrailNode_;
93            float width_;
94            float length_;
95            float lifetime_;
96            size_t maxelements_;
97            std::string trailmaterial_;
98            char tickcount_;
99    };
100}
101
102#endif /* _Backlight_H__ */
Note: See TracBrowser for help on using the repository browser.