Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/presentation2012merge/src/modules/tetris/TetrisBrick.h @ 9322

Last change on this file since 9322 was 9286, checked in by jo, 12 years ago

Merged pCuts branch.

File size: 3.6 KB
RevLine 
[9082]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 TetrisBrick.h
31    @brief Declaration of the TetrisBrick class.
32    @ingroup Tetris
33*/
34
35#ifndef _TetrisBrick_H__
36#define _TetrisBrick_H__
37
38#include "tetris/TetrisPrereqs.h"
39
40#include "worldentities/ControllableEntity.h"
41#include "tools/Timer.h"
42
43namespace orxonox
44{
45
46    /**
47    @brief
48        ContainerClass in order to create TetrisBricks by combining TetrisStones.
49    @author
50
51    @ingroup Tetris
52    */
53    class _TetrisExport TetrisBrick : public ControllableEntity
54    {
55        public:
56            TetrisBrick(BaseObject* creator); //!< Constructor. Registers and initializes the object.
57            virtual ~TetrisBrick() {}
58
59            virtual void moveFrontBack(const Vector2& value); //!< Overloaded the function to steer the bat up and down.
60            virtual void moveRightLeft(const Vector2& value); //!< Overloaded the function to steer the bat up and down.
61            virtual void changedPlayer(); //!< Is called when the player changed.
62
[9084]63            bool isValidMove(const Vector3& position, bool isRotation);
[9082]64            unsigned int getNumberOfStones(void) const
65                { return this->brickStones_.size(); }
66            TetrisStone* getStone(unsigned int i);
67            bool contains(TetrisStone* stone);
68
69            void setGame(Tetris* tetris)
70                { assert(tetris); tetris_ = tetris; }
[9084]71            unsigned int getRotationCount(void)
72                { return this->rotationCount_;}
[9082]73
[9085]74            void releaseStones(TetrisCenterpoint* center);
75
[9082]76        protected:
77            void createBrick(void); //!< Create a cluster of TetrisStones
78            void formBrick(TetrisStone* stone, unsigned int i);
79            Tetris* getTetris();
80
81            unsigned int shapeIndex_; //!< My way to represent the different brick shapes.
82            unsigned int stonesPerBrick_; //!< So many stones are contained in this brick.
83            std::vector<TetrisStone*> brickStones_; //!< A list of all stones in a brick.
84
85
86            void enableMovement(void)
87                { this->delay_ = false; }
88            void unlockRotation(void)
89                { this->lockRotation_ = false; }
90
91            float getSize(void) const
92                { return this->size_; }
93
94
95            float size_; //!< The dimensions a stone has in the game world. //TODO: get stone dimensions
96            bool delay_;
97            bool lockRotation_;
98
[9084]99            unsigned int rotationCount_; //!< Stores the bricks orientation
[9082]100            Timer delayTimer_;
101            Timer rotationTimer_; ///!< This timer is used to filter out multiple rotation inputs.
102            Tetris* tetris_; //<! The Tetris class is responsible to initialize this value.
103
104    };
105}
106
107#endif /* _TetrisBrick_H__ */
Note: See TracBrowser for help on using the repository browser.