Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/SuperOrxoBros_HS18/SuperOrxoBros_HS18/src/modules/tetris/TetrisCenterpoint.h @ 12175

Last change on this file since 12175 was 12175, checked in by siramesh, 5 years ago

Super Orxo Bros (Sidharth Ramesh, Nisa Balta, Jeff Ren)

File size: 5.2 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) override; //!< Method to create a TetrisCenterpoint through XML.
65
66            /**
67            @brief Set the width of the playing field.
68            @param width The width in number of tiles.
69            */
70            void setWidth(unsigned int width)
71                { this->width_ = width; }
72            /**
73            @brief Get the width of the playing field.
74            @return Returns the width in number of tiles.
75            */
76            unsigned int getWidth(void) const
77                { return this->width_; }
78               
79            /**
80            @brief Set the height of the playing field.
81            @param height The height in number of tiles.
82            */
83            void setHeight(unsigned int height)
84                { this->height_ = height; }
85            /**
86            @brief Get the height of the playing field.
87            @return Returns the height in number of tiles.
88            */
89            unsigned int getHeight(void) const
90                { return this->height_; }
91               
92            /**
93            @brief Set the size of a single stone.
94            @param size The dimensions a stone has in the game world. (A stone is a cube)
95            */
96            void setStoneSize(float size)
97                { this->stoneSize_ = size; }
98            /**
99            @brief Get the size of a single stone.
100            @return Returns the dimensions a stone has in the game world.
101            */
102            float getStoneSize(void) const
103                { return this->stoneSize_; }
104               
105            /**
106            @brief Set the template for the stones.
107            @param templateName The template name to be applied to each stone.
108            */
109            void setStoneTemplate(const std::string& templateName)
110                { this->stoneTemplate_ = templateName; }
111            /**
112            @brief Get the template for the stones.
113            @return Returns the template name to be applied to each stone.
114            */
115            const std::string& getStoneTemplate(void) const
116                { return this->stoneTemplate_; }
117           
118            /**
119            @brief Set the template for the bricks.
120            @param templateName The template name to be applied to each brick.
121            */
122            void setBrickTemplate(const std::string& templateName)
123                { this->brickTemplate_ = templateName; }
124            /**
125            @brief Get the template for the bricks.
126            @return Returns the template name to be applied to each brick.
127            */
128            const std::string& getBrickTemplate(void) const
129                { return this->brickTemplate_; }
130
131            /**
132            @brief Set the speed of the stones.
133            @param speed The speed to be set.
134            */
135            void setStoneSpeed(float speed)
136                { this->stoneSpeed_ = speed; }
137            /**
138            @brief Get the speed of the stones.
139            @return Returns the speed a moving stone has.
140            */
141            float getStoneSpeed(void)
142                { return this->stoneSpeed_; }
143
144        private:
145            void checkGametype(); //!< Checks whether the gametype is Tetris and if it is, sets its centerpoint.
146           
147            unsigned int width_;
148            unsigned int height_;
149            float stoneSize_;
150            std::string stoneTemplate_;
151            std::string brickTemplate_;
152            float stoneSpeed_;
153
154    };
155}
156
157#endif /* _TetrisCenterpoint_H__ */
Note: See TracBrowser for help on using the repository browser.