-
Notifications
You must be signed in to change notification settings - Fork 0
/
ShapeLine.cpp
64 lines (50 loc) · 900 Bytes
/
ShapeLine.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
#include "ShapeLine.h"
CShapeLine::CShapeLine()
{
}
CShapeLine::~CShapeLine()
{
}
bool CShapeLine::Init()
{
if (!CShape::Init())
return false;
m_cShape[3][0] = '0';
m_cShape[3][1] = '0';
m_cShape[3][2] = '0';
m_cShape[3][3] = '0';
m_iWidthCount = 4;
m_tPos.x = 4;
m_tPos.y = 0;
m_iDir = RD_DOWN;
return true;
}
void CShapeLine::Rotation()
{
m_iDir = m_iDir == RD_DOWN ? RD_UP : RD_DOWN;
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[0][0] = '0';
m_cShape[1][0] = '0';
m_cShape[2][0] = '0';
m_cShape[3][0] = '0';
m_iWidthCount = 1;
break;
case RD_DOWN:
m_cShape[3][0] = '0';
m_cShape[3][1] = '0';
m_cShape[3][2] = '0';
m_cShape[3][3] = '0';
m_iWidthCount = 4;
break;
}
}