10 win(GRAPHICS_WINDOW_TITLE, GRAPHICS_RESOLUTION_WIDTH, GRAPHICS_RESOLUTION_HEIGHT), |
10 win(GRAPHICS_WINDOW_TITLE, GRAPHICS_RESOLUTION_WIDTH, GRAPHICS_RESOLUTION_HEIGHT), |
11 keyboard(win.get_ic()->get_keyboard()) { |
11 keyboard(win.get_ic()->get_keyboard()) { |
12 |
12 |
13 Vector tmp; |
13 Vector tmp; |
14 CL_Color color; |
14 CL_Color color; |
15 CL_PixelBuffer terr(MAP_WIDTH, MAP_HEIGHT, 3*MAP_WIDTH, CL_PixelFormat::rgb888); |
15 CL_PixelBuffer terr(MAP_WIDTH, MAP_HEIGHT, 4*MAP_WIDTH, CL_PixelFormat::rgba8888); |
16 |
16 |
17 |
17 |
18 for (tmp.x = 0; tmp.x < MAP_WIDTH; tmp.x++) { |
18 for (tmp.x = 0; tmp.x < MAP_WIDTH; tmp.x++) { |
19 for (tmp.y = 0; tmp.y < MAP_HEIGHT; tmp.y++) { |
19 for (tmp.y = 0; tmp.y < MAP_HEIGHT; tmp.y++) { |
20 if (state.getType(tmp) == EMPTY) { |
20 if (state.getType(tmp) == EMPTY) { |
21 color = CL_Color(80, 35, 0); |
21 color = CL_Color(86, 41, 0); |
22 } else if (state.getType(tmp) == DIRT) { |
22 } else if (state.getType(tmp) == DIRT) { |
23 color = CL_Color(144, 82, 23); |
23 color = CL_Color(144, 82, 23); |
24 } else if (state.getType(tmp) == ROCK) { |
24 } else if (state.getType(tmp) == ROCK) { |
25 color = CL_Color(132, 136, 135); |
25 color = CL_Color(132, 136, 135); |
26 } else { |
26 } else { |
27 // Fale |
27 // Fale |
28 } |
28 } |
29 terr.draw_pixel(tmp.x, tmp.y, color); |
29 terr.draw_pixel(tmp.x, tmp.y, color); |
30 } |
30 } |
31 } |
31 } |
32 terrain = CL_Surface(terr); |
32 terrain = CL_Surface(terr); |
33 |
33 |
34 Engine::log(DEBUG, "Graphics") << "Taalla ollaan."; |
34 Engine::log(DEBUG, "Graphics") << "Taalla ollaan."; |
35 |
35 |