Retro_Gameboy
The purpose of this project is to create a GameBoy with classic games.
|
#include <Tetris.h>
Data Structures | |
struct | Point |
Denotes x and y points. More... | |
Public Member Functions | |
Tetris () | |
Default constructor. Used to intialize arrays. More... | |
void | PlayTetris () |
Play Tetris Game. More... | |
![]() | |
GameGenerics () | |
Default Constructor for GameGenerics. This is a abstract class and you cannot instantiate this class. More... | |
Private Member Functions | |
bool | Check () |
Check the boundaries. More... | |
void | MoveTile (const int position=0) |
Move shapes horizontally. More... | |
void | RotateTile (const bool rotate=false) |
Allow user to rotate shapes. More... | |
float | MoveDownTilePerClick (float timer, const float delay, int &colorNum) |
Move shapes down for each tick. More... | |
void | CheckLines () |
Reduce line upon completion. More... | |
void | Draw (Sprite &sprite, Sprite &background, Sprite &frame, RenderWindow &window, const int &colorNum) |
Draw UI and shapes. More... | |
void | EventHandler (bool &rotate, int &dx, RenderWindow &window) |
virtual int | CalculateScore () |
Pure virtual function inherited from GameGenerics.h Each game calculate scores differently and therefore this function need to override in each game according to the game rules. More... | |
Private Attributes | |
int | field [M][N] |
Define a 10 x 20 rectangle. This is use as the background for the game. More... | |
const int | figures [7][4] |
Define 7 x 4 rectangle[ 7 rows, 4 coloumns] This defines the shapes. For example, these are the following shapes. 1,3,5,7, -> denotes I 2,4,5,7, -> denotes Z 3,5,4,6, -> denotes S 3,5,4,7, -> denotes T 2,3,5,7, -> denotes L 3,5,7,6, -> denotes J 2,3,4,5, -> denotes O. More... | |
Point | a [4] |
Use to move shapes. More... | |
Point | b [4] |
Keep a backup. More... | |
Static Private Attributes | |
static const int | M = 20 |
Define width of a rectangle. More... | |
static const int | N = 10 |
Define length of a rectangle. More... | |
Additional Inherited Members | |
![]() | |
void | GameOverScreen (RenderWindow &window) |
Display a game over screen at the end of the game alone with user's score. Currently, every game has the same game over screen. If each and every game needs a different screen, it might be a good idea to make it a pure virtual function. More... | |
Tetris::Tetris | ( | ) |
Default constructor. Used to intialize arrays.
Definition at line 3 of file Tetris.cpp.
|
privatevirtual |
Pure virtual function inherited from GameGenerics.h Each game calculate scores differently and therefore this function need to override in each game according to the game rules.
Implements GameGenerics.
Definition at line 235 of file Tetris.cpp.
|
private |
Check the boundaries.
Definition at line 112 of file Tetris.cpp.
|
private |
Reduce line upon completion.
Definition at line 208 of file Tetris.cpp.
|
private |
Draw UI and shapes.
Definition at line 242 of file Tetris.cpp.
|
private |
|
private |
Move shapes down for each tick.
Definition at line 175 of file Tetris.cpp.
|
private |
Move shapes horizontally.
Definition at line 130 of file Tetris.cpp.
void Tetris::PlayTetris | ( | ) |
Play Tetris Game.
Definition at line 25 of file Tetris.cpp.
|
private |
Allow user to rotate shapes.
Definition at line 148 of file Tetris.cpp.
|
private |
Define 7 x 4 rectangle[ 7 rows, 4 coloumns] This defines the shapes. For example, these are the following shapes. 1,3,5,7, -> denotes I 2,4,5,7, -> denotes Z 3,5,4,6, -> denotes S 3,5,4,7, -> denotes T 2,3,5,7, -> denotes L 3,5,7,6, -> denotes J 2,3,4,5, -> denotes O.
|
staticprivate |
|
staticprivate |