diff options
Diffstat (limited to 'trunk/example.c')
-rw-r--r-- | trunk/example.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/trunk/example.c b/trunk/example.c index ce50ade..317efb2 100644 --- a/trunk/example.c +++ b/trunk/example.c @@ -47,15 +47,17 @@ int main(int argc, char *argv[]) char* filename = argv[1]; - FILE* spritefile = fopen(filename, "rb"); - if (spritefile == NULL) { + FILE* f = fopen(filename, "rb"); + if (f == NULL) { printf("Can't load spritefile %s\n", filename); exit(EXIT_FAILURE); } + struct rosprite_file_context* ctx = rosprite_create_file_context(f); + printf("Loading %s\n", filename); - struct rosprite_area* sprite_area = rosprite_load_file(spritefile); + struct rosprite_area* sprite_area = rosprite_load_file(rosprite_file_reader, ctx); printf("sprite_count %u\n", sprite_area->sprite_count); printf("extension_size %u\n", sprite_area->extension_size); @@ -92,7 +94,8 @@ int main(int argc, char *argv[]) fgetc(stdin); } - fclose(spritefile); + fclose(f); + rosprite_destroy_file_context(ctx); rosprite_destroy_sprite_area(sprite_area); return EXIT_SUCCESS; |