forked from rickyrombo/TileBox
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Actions.cpp
93 lines (89 loc) · 1.92 KB
/
Actions.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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
#include "Common.h"
void Extension::SetTileWidth(int pixels)
{
tileWidth = pixels;
}
void Extension::SetTileHeight(int pixels)
{
tileHeight = pixels;
}
void Extension::SetBoxWidth(int tiles)
{
boxWidth = tiles - 1;
}
void Extension::SetBoxHeight(int tiles)
{
boxHeight = tiles - 1;
}
void Extension::SetStart(int x, int y)
{
startX = x;
startY = y;
}
void Extension::GenerateBox(int curType)
{
for(int x = 0; x <= boxWidth; ++x)
{
for(int y = 0; y <= boxHeight; ++y)
{
currentY[curType] = y;
currentX[curType] = x;
if(y == 0 && x == 0)
{
lastX = startX + tileWidth * x;
lastY = startY + tileHeight * y;
Runtime.GenerateEvent(0);
}
if(x == 0 && y > 0 && y < boxHeight)
{
lastX = startX + tileWidth * x;
lastY = startY + tileHeight * y;
Runtime.GenerateEvent(1);
}
if(x==0 && y == boxHeight)
{
lastX = startX + tileWidth * x;
lastY = startY + tileHeight * y;
Runtime.GenerateEvent(2);
}
if(x > 0 && x < boxWidth && y == 0)
{
lastX = startX + tileWidth * x;
lastY = startY + tileHeight * y;
Runtime.GenerateEvent(3);
}
if(x > 0 && x < boxWidth && y > 0 && y < boxHeight)
{
lastX = startX + tileWidth * x;
lastY = startY + tileHeight * y;
Runtime.GenerateEvent(4);
}
if(x > 0 && x < boxWidth && y == boxHeight)
{
lastX = startX + tileWidth * x;
lastY = startY + tileHeight * y;
Runtime.GenerateEvent(5);
}
if(x == boxWidth && y == 0)
{
lastX = startX + tileWidth * x;
lastY = startY + tileHeight * y;
Runtime.GenerateEvent(6);
}
if(x == boxWidth && y > 0 && y < boxHeight)
{
lastX = startX + tileWidth * x;
lastY = startY + tileHeight * y;
Runtime.GenerateEvent(7);
}
if(x == boxWidth && y == boxHeight)
{
lastX = startX + tileWidth * x;
lastY = startY + tileHeight * y;
Runtime.GenerateEvent(8);
}
}
}
currentX[curType] = -1;
currentY[curType] = -1;
}