Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/tetris/src/modules/pong/PongBall.h @ 8104

Last change on this file since 8104 was 8104, checked in by dafrick, 13 years ago

Started documenting Pong.

  • Property svn:eol-style set to native
File size: 3.0 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/**
30    @file PongBall.h
31    @brief Declaration of the PongBall class.
32    @ingroup Pong
33*/
34
35#ifndef _PongBall_H__
36#define _PongBall_H__
37
38#include "pong/PongPrereqs.h"
39
40#include "util/Math.h"
41
42#include "worldentities/MovableEntity.h"
43
44namespace orxonox
45{
46
47    /**
48    @brief
49        This class manages the ball for Pong.
50
51        //TODO: Describe what it's responnsibilities are.
52        Only moves in x-z area.
53
54    @author
55        Fabian 'x3n' Landau
56
57    @ingroup Pong
58    */
59    class _PongExport PongBall : public MovableEntity
60    {
61        public:
62            PongBall(BaseObject* creator);
63            virtual ~PongBall();
64
65            virtual void tick(float dt);
66
67            void setFieldDimension(float width, float height)
68                { this->fieldWidth_ = width; this->fieldHeight_ = height; }
69            void setFieldDimension(const Vector2& dimension)
70                { this->setFieldDimension(dimension.x, dimension.y); }
71            Vector2 getFieldDimension() const
72                { return Vector2(this->fieldWidth_, this->fieldHeight_); }
73
74            void setSpeed(float speed);
75            float getSpeed() const
76                { return this->speed_; }
77
78            void setAccelerationFactor(float factor)
79                { this->accelerationFactor_ = factor; }
80            float getAccelerationFactor() const
81                { return this->accelerationFactor_; }
82
83            void setBatLength(float batlength)
84                { this->batlength_ = batlength; }
85            float getBatLength() const
86                { return this->batlength_; }
87
88            void setBats(WeakPtr<PongBat>* bats);
89            void applyBats();
90
91            static const float MAX_REL_Z_VELOCITY;
92
93        private:
94            void registerVariables();
95
96            float fieldWidth_;
97            float fieldHeight_;
98            float speed_;
99            float accelerationFactor_;
100            float batlength_;
101            WeakPtr<PongBat>* bat_;
102            bool bDeleteBats_;
103            unsigned int* batID_;
104            float relMercyOffset_;
105    };
106}
107
108#endif /* _PongBall_H__ */
Note: See TracBrowser for help on using the repository browser.