summaryrefslogtreecommitdiffstats
path: root/src/main.c
blob: 0727d5bdeba9f892b1fdc0bd7eb9a850be0a3b28 (plain)
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
#include <SDL.h>
#include "init.h"
#include "logging.h"
#include "resources/image.h"
#include "resources/map.h"

int
main(void)
{
	struct map *map;
	struct image *img;
	struct tileset *ts;
	SDL_Rect imgrect, surfacerect;

	init();

	map = map_get("data/forest1.simple.tmx");
	debug("Map dimensions: %dx%d", map->width, map->height);
	for (ts = map->tilesets_head; ts != NULL; ts = ts->next) {
		debug("Tilesheet name: %s", ts->name);
	}

	img = img_png_get("../forest-6-layer-test_ground.png");
	img_png_free(img);
	return 0;
	img = img_png_get("../forest-6-layer-test_ground.png");
	img = img_png_get("../forest-6-layer-test_ground.png");
	img = img_png_get("../forest-6-layer-test_ground.png");
	img = img_png_get("../forest-6-layer-test_ground.png");
	img_png_free(img);
	img_png_free(img);
	img_png_free(img);
	img = img_png_get("../forest-6-layer-test_ground.png");
	imgrect.w = 240;
	imgrect.h = 160;
	surfacerect.x = 0;
	surfacerect.y = 0;
	surfacerect.w = 240;
	surfacerect.h = 160;

	imgrect.x = 208;
	imgrect.y = 480;
	SDL_BlitSurface(img->image, &imgrect, screen, &surfacerect);
	SDL_Flip(screen);
	SDL_Delay(500);

	imgrect.x = 208;
	imgrect.y = 464;
	SDL_BlitSurface(img->image, &imgrect, screen, &surfacerect);
	SDL_Flip(screen);
	SDL_Delay(500);

	imgrect.x = 224;
	imgrect.y = 464;
	SDL_BlitSurface(img->image, &imgrect, screen, &surfacerect);
	SDL_Flip(screen);
	SDL_Delay(500);

	imgrect.x = 240;
	imgrect.y = 464;
	SDL_BlitSurface(img->image, &imgrect, screen, &surfacerect);
	SDL_Flip(screen);
	SDL_Delay(500);

	imgrect.x = 256;
	imgrect.y = 464;
	SDL_BlitSurface(img->image, &imgrect, screen, &surfacerect);
	SDL_Flip(screen);
	SDL_Delay(500);

	imgrect.x = 256;
	imgrect.y = 448;
	SDL_BlitSurface(img->image, &imgrect, screen, &surfacerect);
	SDL_Flip(screen);
	SDL_Delay(500);

	quit(0);

	/* Control doesn't actually reach here. */
	return 0;
}