-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathblock.h
46 lines (43 loc) · 1 KB
/
block.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
#ifndef _BLOCK_H_
#define _BLOCK_H_
#include <vector>
#include <memory>
#include "block_type.h"
#include "cell.h"
#include "textdisplay.h"
#include "graphicsdisplay.h"
using namespace std;
class Block {
public:
Block(BlockType type, shared_ptr<TextDisplay>, shared_ptr<GraphicsDisplay>, int, int offset_x = 0, int offset_y = 0);
std::vector<Cell> positions();
void down();
void left();
void right();
void clockwise();
void cclockwise();
int colsOccupied(int);
void remove(int);
void dropAbove(int);
void clear();
void draw() const;
vector<int> maxMin() const;
bool isHeavy() const;
bool isEmpty() const;
int getLevel() const;
int getX() const;
int getY() const;
BlockType getType() const;
void changeType(BlockType);
private:
BlockType type;
int level;
int x;
int y;
std::vector<Cell> cells;
std::shared_ptr<TextDisplay> td;
std::shared_ptr<GraphicsDisplay> gd;
void init(vector<vector<int>>, int offset_x = 0, int offset_y = 0);
void shift(int, int);
};
#endif