-
Notifications
You must be signed in to change notification settings - Fork 0
/
BlockManager.h
102 lines (95 loc) · 2.9 KB
/
BlockManager.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
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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
#pragma once
#define BLOCK_WIDTH 2 * SCALE_SIZE
#define BLOCK_HEIGHT 1 * SCALE_SIZE
class BlockManagerC
{
public:
static BlockManagerC *CreateInstance();
static BlockManagerC *GetInstance() {return sInstance;};
~BlockManagerC(){};
BlockC* getBlockPtr();
void init();
void reset(int level);
//void loadLevel(unsigned int levelNumber);
void loadLevel(int level);
void renderBlock();
void shutdown();
void updateBlocks(DWORD milliseconds);
BlockC** getBlocks();
int getMaxBlocks();
private:
static BlockManagerC *sInstance;
BlockManagerC(){};
int mCurLevel;
static const int BLOCK_COLUMNS = 11;
static const int BLOCK_ROWS = 20;
static const int MAX_BLOCKS = BLOCK_COLUMNS * BLOCK_ROWS;
int level1[BLOCK_ROWS][BLOCK_COLUMNS] = {
{0,0,0,0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0,0,0,0},
{0,0,0,0,0,1,0,0,0,0,0},
{0,0,0,0,1,2,1,0,0,0,0},
{0,0,0,1,2,3,2,1,0,0,0},
{0,0,1,2,3,4,3,2,1,0,0},
{0,1,2,3,4,9,4,3,2,1,0},
{1,2,3,4,9,10,9,4,3,2,1},
{0,1,2,3,4,9,4,3,2,1,0},
{0,0,1,2,3,4,3,2,1,0,0},
{0,0,0,1,2,3,2,1,0,0,0},
{0,0,0,0,1,2,1,0,0,0,0},
{0,0,0,0,0,1,0,0,0,0,0},
{0,0,0,0,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0,0,0,2,2,0,1,1},
{0,0,0,0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0,0,0,0},
};
//int* levels[3] = { (int*)level1, (int*)level2, (int*)level3 };
BlockC** mBlockArray;
};