-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathBlock.cpp
More file actions
48 lines (32 loc) · 873 Bytes
/
Block.cpp
File metadata and controls
48 lines (32 loc) · 873 Bytes
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
#include "Block.h"
Block::Block(LPCWSTR bitmapPath, Graphics *gfx, char symbol,
bool collisionEnabled, int index, int maxGeneratingHeight, int seed) {
this->symbol = symbol;
this->collisionEnabled = collisionEnabled;
this->gfx = gfx;
this->index = index;
this->maxGeneratingHeight = maxGeneratingHeight;
this->seed = seed;
sprites = new SpriteSheet(bitmapPath, gfx, spriteWidth, spriteHeight);
}
Block::~Block() {
delete sprites;
}
void Block::Render(int x, int y, int offset){
sprites->Draw(index, static_cast<float>(x * spriteWidth - offset) , static_cast<float>(y * spriteHeight));
}
int Block::GetSeed() {
return seed;
}
int Block::GetMaxGenerationHeight() {
return maxGeneratingHeight;
}
int Block::GetIndex() {
return index;
}
char Block::GetSymbol() {
return symbol;
}
bool Block::IsCollisionEnabled() {
return collisionEnabled;
}