-
Notifications
You must be signed in to change notification settings - Fork 0
/
ShapeT.cpp
78 lines (64 loc) · 1.11 KB
/
ShapeT.cpp
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
#include "ShapeT.h"
CShapeT::CShapeT()
{
}
CShapeT::~CShapeT()
{
}
bool CShapeT::Init()
{
if (!CShape::Init())
return false;
m_cShape[2][0] = '0';
m_cShape[2][1] = '0';
m_cShape[2][2] = '0';
m_cShape[3][1] = '0';
m_iWidthCount = 3;
m_tPos.x = 4;
m_tPos.y = 0;
m_iDir = RD_DOWN;
return true;
}
void CShapeT::Rotation()
{
++m_iDir;
m_iDir %= RD_END;
for (int i = 0; i < 4; ++i)
{
for (int j = 0; j < 4; ++j)
{
m_cShape[i][j] = '1';
}
}
switch (m_iDir)
{
case RD_UP:
m_cShape[2][1] = '0';
m_cShape[3][0] = '0';
m_cShape[3][1] = '0';
m_cShape[3][2] = '0';
m_iWidthCount = 3;
break;
case RD_RIGHT:
m_cShape[1][0] = '0';
m_cShape[2][0] = '0';
m_cShape[3][0] = '0';
m_cShape[2][1] = '0';
m_iWidthCount = 2;
break;
case RD_DOWN:
m_cShape[2][0] = '0';
m_cShape[2][1] = '0';
m_cShape[2][2] = '0';
m_cShape[3][1] = '0';
m_iWidthCount = 3;
break;
case RD_LEFT:
m_cShape[1][1] = '0';
m_cShape[2][1] = '0';
m_cShape[3][1] = '0';
m_cShape[2][0] = '0';
m_iWidthCount = 2;
break;
}
}