| 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 TetrisStone.h | 
|---|
| 31 | @brief Declaration of the TetrisStone class. | 
|---|
| 32 | @ingroup Tetris | 
|---|
| 33 | */ | 
|---|
| 34 |  | 
|---|
| 35 | #ifndef _TetrisStone_H__ | 
|---|
| 36 | #define _TetrisStone_H__ | 
|---|
| 37 |  | 
|---|
| 38 | #include "tetris/TetrisPrereqs.h" | 
|---|
| 39 |  | 
|---|
| 40 | #include "worldentities/MovableEntity.h" | 
|---|
| 41 | #include "tools/Timer.h" | 
|---|
| 42 |  | 
|---|
| 43 | namespace orxonox | 
|---|
| 44 | { | 
|---|
| 45 |  | 
|---|
| 46 | /** | 
|---|
| 47 | @brief | 
|---|
| 48 |  | 
|---|
| 49 | @author | 
|---|
| 50 |  | 
|---|
| 51 | @ingroup Tetris | 
|---|
| 52 | */ | 
|---|
| 53 | class _TetrisExport TetrisStone : public MovableEntity | 
|---|
| 54 | { | 
|---|
| 55 | public: | 
|---|
| 56 | TetrisStone(Context* context); //!< Constructor. Registers and initializes the object. | 
|---|
| 57 | virtual ~TetrisStone() {} | 
|---|
| 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 |  | 
|---|
| 62 | virtual void changedPlayer(); //!< Is called when the player changed. | 
|---|
| 63 |  | 
|---|
| 64 | /** | 
|---|
| 65 | @brief Set the size of the stone. | 
|---|
| 66 | @param size The dimensions a stone has in the game world. (A stone is a cube) | 
|---|
| 67 | */ | 
|---|
| 68 | void setSize(float size) | 
|---|
| 69 | { this->size_ = size; } | 
|---|
| 70 | /** | 
|---|
| 71 | @brief Get the size of the stone. | 
|---|
| 72 | @return Returns the dimensions a stone has in the game world. (A stone is a cube) | 
|---|
| 73 | */ | 
|---|
| 74 | float getSize(void) const | 
|---|
| 75 | { return this->size_; } | 
|---|
| 76 |  | 
|---|
| 77 | void setGame(Tetris* tetris) | 
|---|
| 78 | { assert(tetris); tetris_ = tetris; } | 
|---|
| 79 |  | 
|---|
| 80 | private: | 
|---|
| 81 | void enableMovement(void) | 
|---|
| 82 | { this->delay_ = false; } | 
|---|
| 83 | void unlockRotation(void) | 
|---|
| 84 | { this->lockRotation_ = false; } | 
|---|
| 85 |  | 
|---|
| 86 | float size_; //!< The dimensions a stone has in the game world. | 
|---|
| 87 | bool delay_; | 
|---|
| 88 | bool lockRotation_; | 
|---|
| 89 | Timer delayTimer_; | 
|---|
| 90 | Timer rotationTimer_; ///!< This timer is used to filter out multiple rotation inputs. | 
|---|
| 91 |  | 
|---|
| 92 | Tetris* tetris_; | 
|---|
| 93 | }; | 
|---|
| 94 | } | 
|---|
| 95 |  | 
|---|
| 96 | #endif /* _TetrisStone_H__ */ | 
|---|