Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/trunk/src/modules/tetris/TetrisCenterpoint.h @ 9667

Last change on this file since 9667 was 9667, checked in by landauf, 11 years ago

merged core6 back to trunk

  • Property svn:eol-style set to native
File size: 5.3 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{//idea: add 2 triggers to the centerpoint (one to determine when a box would go above the centerpoint;
48//the other to find out when the lowest row is filled totally)
49   
50    /**
51    @brief
52       
53   
54    @author
55       
56    @ingroup Tetris
57    */
58    class _TetrisExport TetrisCenterpoint : public StaticEntity
59    {
60        public:
61            TetrisCenterpoint(Context* context); //!< Constructor. Registers and initializes the object and checks whether the gametype is actually Tetris.
62            virtual ~TetrisCenterpoint() {}
63
64            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); //!< Method to create a TetrisCenterpoint through XML.
65
66            virtual void changedGametype(); //!< Is called when the gametype has changed.
67           
68            /**
69            @brief Set the width of the playing field.
70            @param width The width in number of tiles.
71            */
72            void setWidth(unsigned int width)
73                { this->width_ = width; }
74            /**
75            @brief Get the width of the playing field.
76            @return Returns the width in number of tiles.
77            */
78            unsigned int getWidth(void) const
79                { return this->width_; }
80               
81            /**
82            @brief Set the height of the playing field.
83            @param height The height in number of tiles.
84            */
85            void setHeight(unsigned int height)
86                { this->height_ = height; }
87            /**
88            @brief Get the height of the playing field.
89            @return Returns the height in number of tiles.
90            */
91            unsigned int getHeight(void) const
92                { return this->height_; }
93               
94            /**
95            @brief Set the size of a single stone.
96            @param size The dimensions a stone has in the game world. (A stone is a cube)
97            */
98            void setStoneSize(float size)
99                { this->stoneSize_ = size; }
100            /**
101            @brief Get the size of a single stone.
102            @return Returns the dimensions a stone has in the game world.
103            */
104            float getStoneSize(void) const
105                { return this->stoneSize_; }
106               
107            /**
108            @brief Set the template for the stones.
109            @param template The template name to be applied to each stone.
110            */
111            void setStoneTemplate(const std::string& templateName)
112                { this->stoneTemplate_ = templateName; }
113            /**
114            @brief Get the template for the stones.
115            @return Returns the template name to be applied to each stone.
116            */
117            const std::string& getStoneTemplate(void) const
118                { return this->stoneTemplate_; }
119           
120            /**
121            @brief Set the template for the bricks.
122            @param template The template name to be applied to each brick.
123            */
124            void setBrickTemplate(const std::string& templateName)
125                { this->brickTemplate_ = templateName; }
126            /**
127            @brief Get the template for the bricks.
128            @return Returns the template name to be applied to each brick.
129            */
130            const std::string& getBrickTemplate(void) const
131                { return this->brickTemplate_; }
132
133            /**
134            @brief Set the speed of the stones.
135            @param speed The speed to be set.
136            */
137            void setStoneSpeed(float speed)
138                { this->stoneSpeed_ = speed; }
139            /**
140            @brief Get the speed of the stones.
141            @return Returns the speed a moving stone has.
142            */
143            float getStoneSpeed(void)
144                { return this->stoneSpeed_; }
145
146        private:
147            void checkGametype(); //!< Checks whether the gametype is Tetris and if it is, sets its centerpoint.
148           
149            unsigned int width_;
150            unsigned int height_;
151            float stoneSize_;
152            std::string stoneTemplate_;
153            std::string brickTemplate_;
154            float stoneSpeed_;
155
156    };
157}
158
159#endif /* _TetrisCenterpoint_H__ */
Note: See TracBrowser for help on using the repository browser.