-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathBlock.h
35 lines (32 loc) · 993 Bytes
/
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
#pragma once
#include <iostream>
#include <vector>
#include "Utils.h"
#include "Board.h"
class Point;
class Board;
class Block {
char ch;
int size;
Board* pBoard = nullptr;
std::vector<Point> points;
public:
// Ctor
Block(char _ch, int _size, Board* _pBoard, std::vector<Point> _points) : ch(_ch), size(_size), pBoard(_pBoard), points(_points) {}
// Return the points of the block
const std::vector<Point>& getPoints() const { return points; }
// Return the size of the block
int getSize() const { return size; }
// Return the char of the block
char getChar() const { return ch; }
// Move the block on board according to dirx, diry
void move(int dirx, int diry);
// Draw the block on screen
void drawOnScreen() const;
// Delete the block from screen
void deleteFromScreen() const;
// Checks if the block has the Point p
bool isBlockIncludesPoint(Point p) const;
// Moving the pointsof the block without deleting or drawing
void setPointsIndexes(int dirx, int diry);
};