Orxonox  0.0.5 Codename: Arcturus
TetrisBrick.h
Go to the documentation of this file.
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 
35 #ifndef _TetrisBrick_H__
36 #define _TetrisBrick_H__
37 
38 #include "tetris/TetrisPrereqs.h"
39 
41 #include "tools/Timer.h"
42 
43 namespace orxonox
44 {
45 
54  {
55  public:
56  TetrisBrick(Context* context);
57  virtual ~TetrisBrick() {}
58 
59  virtual void moveFrontBack(const Vector2& value) override;
60  virtual void moveRightLeft(const Vector2& value) override;
61  virtual void changedPlayer() override;
62 
63  bool isValidMove(const Vector3& position, bool isRotation);
64  unsigned int getNumberOfStones(void) const
65  { return this->brickStones_.size(); }
66  TetrisStone* getStone(unsigned int i);
67 
68  void setGame(Tetris* tetris)
69  { assert(tetris); tetris_ = tetris; }
70  unsigned int getRotationCount(void)
71  { return this->rotationCount_;}
72 
73  void releaseStones(TetrisCenterpoint* center);
74 
75  protected:
76  void createBrick(void);
77  void formBrick(TetrisStone* stone, unsigned int i);
78  Tetris* getTetris();
79 
80  unsigned int shapeIndex_;
81  unsigned int stonesPerBrick_;
82  std::vector<TetrisStone*> brickStones_;
83 
84 
85  void enableMovement(void)
86  { this->delay_ = false; }
87  void unlockRotation(void)
88  { this->lockRotation_ = false; }
89 
90  float getSize(void) const
91  { return this->size_; }
92 
93 
94  float size_;
95  bool delay_;
97 
98  unsigned int rotationCount_;
101  Tetris* tetris_; //<! The Tetris class is responsible to initialize this value.
102 
103  };
104 }
105 
106 #endif /* _TetrisBrick_H__ */
Timer rotationTimer_
Definition: TetrisBrick.h:100
unsigned int stonesPerBrick_
So many stones are contained in this brick.
Definition: TetrisBrick.h:81
unsigned int rotationCount_
Stores the bricks orientation.
Definition: TetrisBrick.h:98
unsigned int getNumberOfStones(void) const
Definition: TetrisBrick.h:64
float getSize(void) const
Definition: TetrisBrick.h:90
ContainerClass in order to create TetrisBricks by combining TetrisStones.
Definition: TetrisBrick.h:53
virtual ~TetrisBrick()
Definition: TetrisBrick.h:57
Shared library macros, enums, constants and forward declarations for the tetris module ...
Definition: TetrisCenterpoint.h:58
void unlockRotation(void)
Definition: TetrisBrick.h:87
Declaration of the Timer class, used to call functions after a given time-interval.
unsigned int shapeIndex_
My way to represent the different brick shapes.
Definition: TetrisBrick.h:80
Die Wagnis Klasse hat die folgenden Aufgaben:
Definition: ApplicationPaths.cc:66
Definition: Tetris.h:54
Timer delayTimer_
Definition: TetrisBrick.h:99
Definition: Context.h:45
void enableMovement(void)
Definition: TetrisBrick.h:85
Definition: TetrisStone.h:53
#define _TetrisExport
Definition: TetrisPrereqs.h:58
float size_
The dimensions a stone has in the game world. //TODO: get stone dimensions.
Definition: TetrisBrick.h:94
std::vector< TetrisStone * > brickStones_
A list of all stones in a brick.
Definition: TetrisBrick.h:82
bool delay_
Definition: TetrisBrick.h:95
Timer is a helper class that executes a function after a given amount of seconds in game-time...
Definition: Timer.h:105
Tetris * tetris_
!< This timer is used to filter out multiple rotation inputs.
Definition: TetrisBrick.h:101
The ControllableEntity is derived from the orxonox::MobileEntity.
Definition: ControllableEntity.h:48
void setGame(Tetris *tetris)
Definition: TetrisBrick.h:68
unsigned int getRotationCount(void)
Definition: TetrisBrick.h:70
bool lockRotation_
Definition: TetrisBrick.h:96