diff options
-rw-r--r-- | src/main.c | 40 |
1 files changed, 30 insertions, 10 deletions
@@ -38,8 +38,6 @@ main(void) if (map == NULL) { err(1, "Where's the map, George?"); } - a = area_new(map); - for (i = 0; i < 256; ++i) { colors[i].r = (i % 8) * 36; colors[i].g = (i % 64 / 8) * 36; @@ -48,14 +46,7 @@ main(void) if (!SDL_SetPalette(vp->screen, SDL_LOGPAL, colors, 0, 256)) { warn("Failed to set palette"); } - for (i = 0; i < 256; ++i) { - colors[i].r = i; - colors[i].g = i; - colors[i].b = i; - } -/* if (!SDL_SetPalette(vp->screen, SDL_PHYSPAL, colors, 0, 256)) { - warn("Failed to set palette"); - }*/ + a = area_new(map, vp); for (e = map->map_exits_head; e != NULL; e = e->next) { debug("Map exit (size %dx%d) at (%d,%d) " @@ -67,7 +58,36 @@ main(void) e->target_x_coord, e->target_y_coord); } + render_area_to_viewport(a, vp); + { + float step; + for (step = 1.0; step >= 0.25; step -= 0.00390625) { + for (i = 0; i < 256; ++i) { + colors[i].r = (i % 8) * 36; + colors[i].g = (i % 64 / 8) * 36; + colors[i].b = (i / 64) * 85; + colors[i].r *= step; + colors[i].g *= step; + colors[i].b *= step; + } + if (!SDL_SetPalette(vp->screen, SDL_LOGPAL, colors, 0, 256)) { + warn("Failed to set palette"); + } + SDL_Flip(vp->screen); + SDL_Delay(10); + } + } + SDL_Delay(1000); + /* Demo */ + for (i = 0; i < 256; ++i) { + colors[i].r = (i % 8) * 36; + colors[i].g = (i % 64 / 8) * 36; + colors[i].b = (i / 64) * 85; + } + if (!SDL_SetPalette(vp->screen, SDL_LOGPAL, colors, 0, 256)) { + warn("Failed to set palette"); + } i = 0; start = SDL_GetTicks(); x = 19 * map->tilewidth ; |