Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/presentation/src/modules/tetris/TetrisCenterpoint.h @ 8564

Last change on this file since 8564 was 8564, checked in by dafrick, 14 years ago

Merging tetris branch into presentation branch.

File size: 4.6 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 *      ...
24 *   Co-authors:
25 *      ...
26 *
27 */
28
29/**
30    @file TetrisCenterpoint.h
31    @brief Declaration of the TetrisCenterpoint class.
32    @ingroup Tetris
33*/
34
35#ifndef _TetrisCenterpoint_H__
36#define _TetrisCenterpoint_H__
37
38#include "tetris/TetrisPrereqs.h"
39
40#include <string>
41
42#include <util/Math.h>
43
44#include "worldentities/StaticEntity.h"
45
46namespace orxonox
47{
48   
49    /**
50    @brief
51       
52   
53    @author
54       
55    @ingroup Tetris
56    */
57    class _TetrisExport TetrisCenterpoint : public StaticEntity
58    {
59        public:
60            TetrisCenterpoint(BaseObject* creator); //!< Constructor. Registers and initializes the object and checks whether the gametype is actually Tetris.
61            virtual ~TetrisCenterpoint() {}
62
63            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); //!< Method to create a TetrisCenterpoint through XML.
64
65            virtual void changedGametype(); //!< Is called when the gametype has changed.
66           
67            /**
68            @brief Set the width of the playing field.
69            @param width The width in number of tiles.
70            */
71            void setWidth(unsigned int width)
72                { this->width_ = width; }
73            /**
74            @brief Get the width of the playing field.
75            @return Returns the width in number of tiles.
76            */
77            unsigned int getWidth(void) const
78                { return this->width_; }
79               
80            /**
81            @brief Set the height of the playing field.
82            @param height The height in number of tiles.
83            */
84            void setHeight(unsigned int height)
85                { this->height_ = height; }
86            /**
87            @brief Get the height of the playing field.
88            @return Returns the height in number of tiles.
89            */
90            unsigned int getHeight(void) const
91                { return this->height_; }
92               
93            /**
94            @brief Set the size of a single stone.
95            @param size The dimensions a stone has in the game world. (A stone is a cube)
96            */
97            void setStoneSize(float size)
98                { this->stoneSize_ = size; }
99            /**
100            @brief Get the size of a single stone.
101            @return Returns the dimensions a stone has in the game world.
102            */
103            float getStoneSize(void) const
104                { return this->stoneSize_; }
105               
106            /**
107            @brief Set the template for the stones.
108            @param template The template name to be applied to each stone.
109            */
110            void setStoneTemplate(const std::string& templateName)
111                { this->stoneTemplate_ = templateName; }
112            /**
113            @brief Get the template for the stones.
114            @return Returns the template name to be applied to each stone.
115            */
116            const std::string& getStoneTemplate(void) const
117                { return this->stoneTemplate_; }
118           
119            /**
120            @brief Set the speed of the stones.
121            @param speed The speed to be set.
122            */
123            void setStoneSpeed(float speed)
124                { this->stoneSpeed_ = speed; }
125            /**
126            @brief Get the speed of the stones.
127            @return Returns the speed a moving stone has.
128            */
129            float getStoneSpeed(void)
130                { return this->stoneSpeed_; }
131
132        private:
133            void checkGametype(); //!< Checks whether the gametype is Tetris and if it is, sets its centerpoint.
134           
135            unsigned int width_;
136            unsigned int height_;
137            float stoneSize_;
138            std::string stoneTemplate_;
139            float stoneSpeed_;
140
141    };
142}
143
144#endif /* _TetrisCenterpoint_H__ */
Note: See TracBrowser for help on using the repository browser.