-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathBlock.h
46 lines (36 loc) · 790 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
36
37
38
39
40
41
42
43
44
45
46
#pragma once
class Block
{
private:
S2D_Image* mImg;
int mX = 0, mY = 0;
public:
void SetColor(float r, float g, float b)
{
mImg->color.r = r;
mImg->color.g = g;
mImg->color.b = b;
mImg->color.a = 1.0;
}
Block(int aX, int aY, float aR = 0, float aG = 0, float aB = 0)
: mX(aX), mY(aY)
{
string imagePath = string("img\\square0.bmp");
mImg = S2D_CreateImage(imagePath.c_str());
SetColor(aR, aG, aB);
}
static int GetSize() { return 51; }
void Render()
{
mImg->x = mX;
mImg->y = mY;
S2D_DrawImage(mImg);
}
void UpdatePos(float aDXunits, float aDYunits)
{
mX += (int)(GetSize() * aDXunits);
mY += (int)(GetSize() * aDYunits);
}
int GetX() const { return mX; }
int GetY() const { return mY; }
};