summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJames Shaw <jshaw@netsurf-browser.org>2008-07-19 15:56:33 (GMT)
committer James Shaw <jshaw@netsurf-browser.org>2008-07-19 15:56:33 (GMT)
commit5badfb5fb1c21da98e1076cf021957e8a934ddf3 (patch)
tree0e4904d1e4eff719559ee946a12f1e4bbb291f62
parentfd6e11f9c16fcdf4b649e5a1ae18306e534ebf20 (diff)
downloadlibrosprite-5badfb5fb1c21da98e1076cf021957e8a934ddf3.tar.gz
librosprite-5badfb5fb1c21da98e1076cf021957e8a934ddf3.tar.bz2
Tidy up example app
svn path=/import/jshaw/libsprite/; revision=10027
-rw-r--r--trunk/example.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/trunk/example.c b/trunk/example.c
index 1da51a8..4f9755e 100644
--- a/trunk/example.c
+++ b/trunk/example.c
@@ -33,13 +33,17 @@ int main(int argc, char *argv[])
if ( SDL_Init(SDL_INIT_VIDEO) < 0 ) {
fprintf(stderr, "Unable to init SDL: %s\n", SDL_GetError());
- exit(1);
+ exit(EXIT_FAILURE);
}
atexit(SDL_Quit);
char* filename = argv[1];
void* ctx;
- create_file_context(filename, &ctx);
+ if (create_file_context(filename, &ctx) < 0) {
+ fprintf(stderr, "Unable to create file reader context\n");
+ exit(EXIT_FAILURE);
+ }
+
printf("Loading %s\n", filename);
struct rosprite_area* sprite_area;
@@ -54,7 +58,7 @@ int main(int argc, char *argv[])
screen = SDL_SetVideoMode(800, 600, 32, SDL_ANYFORMAT);
SDL_SetAlpha(screen, SDL_SRCALPHA, 0);
- for (uint32_t i = 0; i < sprite_area->sprite_count; i++) {
+ for (unsigned int i = 0; i < sprite_area->sprite_count; i++) {
struct rosprite* sprite = sprite_area->sprites[i];
printf("\nname %s\n", sprite->name);
printf("color_model %s\n", sprite->mode.color_model == ROSPRITE_RGB ? "RGB" : "CMYK");