-
Notifications
You must be signed in to change notification settings - Fork 0
/
draw.cpp
130 lines (127 loc) · 4.65 KB
/
draw.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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
#include "mainobject.h"
#include "play.h"
#include "draw.h"
void draw_::RenderMap(){
SDL_RenderClear(renderer);
Map.renderTexture(bg, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
for (int i = 0; i < MAX_MAP_Y; i++){
for (int j = 0; j < MAX_MAP_X; j++){
int pos_y = i*TILE_SIZE;
int pos_x = j*TILE_SIZE;
switch (mat[i][j]) {
case 1: {
Map.renderTexture(img[1], pos_x, pos_y, TILE_SIZE, TILE_SIZE);
break;
}
case 2: {
if(!ok[2])
Map.renderTexture(img[1], pos_x, pos_y, TILE_SIZE, TILE_SIZE);
break;
}
case 3: {
if(!ok[3])
Map.renderTexture(img[1], pos_x, pos_y, TILE_SIZE, TILE_SIZE);
break;
}
case 4: {
if(!ok[4])
Map.renderTexture(img[1], pos_x, pos_y, TILE_SIZE, TILE_SIZE);
break;
}
case 5: {
if(ok[5])
Map.renderTexture(img[2], pos_x, pos_y, TILE_SIZE, TILE_SIZE);
break;
}
case 6: {
if(ok[6])
Map.renderTexture(img[2], pos_x, pos_y, TILE_SIZE, TILE_SIZE);
break;
}
case 7: {
if(ok[7])
Map.renderTexture(img[2], pos_x, pos_y, TILE_SIZE, TILE_SIZE);
break;
}
case 8: {
if(ok[8])
Map.renderTexture(img[3], pos_x, pos_y, TILE_SIZE, TILE_SIZE);
break;
}
case 9: {
if(ok[9])
Map.renderTexture(img[3], pos_x, pos_y, TILE_SIZE, TILE_SIZE);
break;
}
case 10: {
if(ok[10])
Map.renderTexture(img[3], pos_x, pos_y, TILE_SIZE, TILE_SIZE);
break;
}
case 11: {
if(ok[11])
Map.renderTexture(img[4], pos_x, pos_y, TILE_SIZE, TILE_SIZE);
break;
}
case 12: {
if(ok[12])
Map.renderTexture(img[4], pos_x, pos_y, TILE_SIZE, TILE_SIZE);
break;
}
case 13: {
if(ok[13])
Map.renderTexture(img[4], pos_x, pos_y, TILE_SIZE, TILE_SIZE);
break;
}
case 14: {
if(ok[14])
Map.renderTexture(img[5], pos_x, pos_y, TILE_SIZE, TILE_SIZE);
break;
}
case 15: {
if(ok[15])
Map.renderTexture(img[5], pos_x, pos_y, TILE_SIZE, TILE_SIZE);
break;
}
case 16: {
if(ok[16])
Map.renderTexture(img[5], pos_x, pos_y, TILE_SIZE, TILE_SIZE);
break;
}
case 17: {
if(ok[17])
Map.renderTexture(img[9], pos_x, pos_y, TILE_SIZE, TILE_SIZE);
break;
}
case 18: {
if(ok[18])
Map.renderTexture(img[9], pos_x, pos_y, TILE_SIZE, TILE_SIZE);
break;
}
case 19: {
if(ok[19])
Map.renderTexture(img[9], pos_x, pos_y, TILE_SIZE, TILE_SIZE);
break;
}
case 20: {
Map.renderTexture(img[7], pos_x, pos_y, TILE_SIZE, TILE_SIZE);
break;
}
case 21: {
Map.renderTexture(img[8], pos_x, pos_y, TILE_SIZE, TILE_SIZE);
break;
}
case 22: {
Map.renderTexture(img[6], pos_x, pos_y, TILE_SIZE, TILE_SIZE);
break;
}
}
}
}
}
void draw_::show_dango() {
rect_.x = x_pos_ ;
rect_.y = y_pos_ ;
SDL_Rect renderQuad = {rect_.x, rect_.y, rect_.w, rect_.h};
SDL_RenderCopy(renderer, dango, NULL, &renderQuad);
}