diff options
author | Paul Duncan <pabs@pablotron.org> | 2019-01-16 12:09:25 -0500 |
---|---|---|
committer | Paul Duncan <pabs@pablotron.org> | 2019-01-16 12:09:25 -0500 |
commit | df812e3dcd0af5ba932264d7ca1e0131a4a43019 (patch) | |
tree | f9718070c6084079ac2ceb80b7f2b678787ed7aa /src/sdl/main.c | |
parent | 11fe11568e27e5fc7d5d58ee64cb83b185240daf (diff) | |
download | sok-df812e3dcd0af5ba932264d7ca1e0131a4a43019.tar.bz2 sok-df812e3dcd0af5ba932264d7ca1e0131a4a43019.zip |
animate failed moves
Diffstat (limited to 'src/sdl/main.c')
-rw-r--r-- | src/sdl/main.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/sdl/main.c b/src/sdl/main.c index 82d6682..123b1d7 100644 --- a/src/sdl/main.c +++ b/src/sdl/main.c @@ -165,6 +165,7 @@ int main(int argc, char *argv[]) { .renderer = renderer, .zoom = &zoom, .theme = theme_get_default(), + .bump_ticks = SDL_GetTicks() - 5000, }; // set level @@ -184,6 +185,7 @@ int main(int argc, char *argv[]) { bool is_fullscreen = false; bool done = false; while (!done) { + const Uint32 ticks = SDL_GetTicks(); SDL_Event ev; // read events @@ -201,12 +203,14 @@ int main(int argc, char *argv[]) { break; case ACTION_MOVE: if (!sok_ctx_move(&ctx, (sok_dir_t) action.data)) { + draw_ctx.bump_ticks = ticks; warn("move %s failed", SOK_DIR_TO_STR((sok_dir_t) action.data)); } break; case ACTION_UNDO: if (!sok_ctx_undo(&ctx)) { + draw_ctx.bump_ticks = ticks; warn("undo failed"); } @@ -219,6 +223,7 @@ int main(int argc, char *argv[]) { // set level set_level(&draw_ctx, &ctx, level_num); } else { + draw_ctx.bump_ticks = ticks; warn("cannot advance to next level"); } |