forked from megamarc/Tilengine
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Test.c
49 lines (41 loc) · 1.09 KB
/
Test.c
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
/* Compile test without windowing component, not for real execution */
#include "Tilengine.h"
#define WIDTH 400
#define HEIGHT 240
static uint8_t framebuffer[WIDTH * HEIGHT * 4];
int main (int argc, char* argv[])
{
int c;
TLN_Tilemap tilemap = NULL;
TLN_Spriteset spriteset = NULL;
/* basic setup */
TLN_Init(WIDTH, HEIGHT, 1, 1, 1);
TLN_SetBGColor (0,128,238);
TLN_SetRenderTarget(framebuffer, WIDTH * 4);
TLN_SetLoadPath("../assets/sonic");
TLN_SetLogLevel(TLN_LOG_VERBOSE);
printf("Tilengine version %06X\n", TLN_GetVersion());
/* test layer */
for (c = 0; c < 2; c++)
{
TLN_SetLayer(0, NULL, tilemap);
if (tilemap == NULL)
tilemap = TLN_LoadTilemap("Sonic_md_bg1.tmx", NULL);
}
TLN_SetLayerPosition(1, 0, 0);
TLN_SetLayerPosition(0, 0, 0);
/* test sprite */
for (c = 0; c < 2; c++)
{
TLN_ConfigSprite(0, spriteset, 0);
if (spriteset == NULL)
spriteset = TLN_LoadSpriteset("smw_sprite");
}
TLN_SetSpritePosition(1, 10, 10);
TLN_SetSpritePosition(0, 10, 10);
TLN_UpdateFrame(0);
TLN_DeleteSpriteset(spriteset);
TLN_DeleteTilemap(tilemap);
TLN_Deinit ();
return 0;
}