-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBoard.h
54 lines (40 loc) · 1.67 KB
/
Board.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#ifndef _Board_
#define _Board_
#pragma once
#include "Pieces.h"
#include "ParticleEngine.h"
#include <SFML/Audio.hpp>
#endif
#define BOARD_LINE_WIDTH 40 // Width of each of the two lines that delimit the board
#define BLOCK_SIZE 20 // Width and Height of each block of a piece
#define BOARD_POSITION 320 // Center position of the board from the left of the screen
#define BOARD_WIDTH 10 // Board width in blocks
#define BOARD_HEIGHT 20 // Board height in blocks
#define MIN_VERTICAL_MARGIN 20 // Minimum vertical margin for the board limit
#define MIN_HORIZONTAL_MARGIN 20 // Minimum horizontal margin for the board limit
#define PIECE_BLOCKS 5 // Number of horizontal and vertical blocks of a matrix piece
class Board
{
public:
virtual ~Board(void);
Board (Pieces *pPieces, int pScreenHeight);
int GetXPosInPixels (int pPos);
int GetYPosInPixels (int pPos);
bool IsFreeBlock (int pX, int pY);
bool IsPossibleMovement (int pX, int pY, int pPiece, int pRotation);
void StorePiece (int pX, int pY, int pPiece, int pRotation);
void DeletePossibleLines ();
bool IsGameOver ();
void InitBoard ();
int mBoard [BOARD_WIDTH][BOARD_HEIGHT]; // Board that contains the pieces
int mScore;
std::vector<ParticleEngine> particleEngines;
sf::SoundBuffer buffer;
sf::Sound sound;
private:
Board(void);
enum { POS_FREE, POS_FILLED }; // POS_FREE = free position of the board; POS_FILLED = filled position of the board
Pieces *mPieces;
int mScreenHeight;
void DeleteLine (int pY);
};