aboutsummaryrefslogtreecommitdiff
path: root/midend.c
diff options
context:
space:
mode:
authorSimon Tatham <anakin@pobox.com>2004-05-11 18:37:20 +0000
committerSimon Tatham <anakin@pobox.com>2004-05-11 18:37:20 +0000
commitcdfc740fe45e17d61075d653d45efedcd9743805 (patch)
treea546a93f0971b5f88917a43cdff2ef0f627f0c91 /midend.c
parenteb8a374d0dd263953647067ec26b1fc33661d3f5 (diff)
downloadpuzzles-cdfc740fe45e17d61075d653d45efedcd9743805.zip
puzzles-cdfc740fe45e17d61075d653d45efedcd9743805.tar.gz
puzzles-cdfc740fe45e17d61075d653d45efedcd9743805.tar.bz2
puzzles-cdfc740fe45e17d61075d653d45efedcd9743805.tar.xz
Don't rush move animation to a conclusion on a subsequent keypress
unless there's actual activity happening as a result of the move. Net animations were tending to get rushed to conclusion by the mouse button release now that it's being reported to the mid-end. [originally from svn r4211]
Diffstat (limited to 'midend.c')
-rw-r--r--midend.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/midend.c b/midend.c
index a2aee45..63ba193 100644
--- a/midend.c
+++ b/midend.c
@@ -158,29 +158,36 @@ static void midend_finish_move(midend_data *me)
activate_timer(me->frontend);
}
-int midend_process_key(midend_data *me, int x, int y, int button)
+static void midend_stop_anim(midend_data *me)
{
- game_state *oldstate = dup_game(me->states[me->statepos - 1]);
- float anim_time;
-
if (me->oldstate || me->anim_time) {
midend_finish_move(me);
midend_redraw(me);
}
+}
+
+int midend_process_key(midend_data *me, int x, int y, int button)
+{
+ game_state *oldstate = dup_game(me->states[me->statepos - 1]);
+ float anim_time;
if (button == 'n' || button == 'N' || button == '\x0E') {
+ midend_stop_anim(me);
midend_new_game(me);
midend_redraw(me);
return 1; /* never animate */
} else if (button == 'r' || button == 'R') {
+ midend_stop_anim(me);
midend_restart_game(me);
midend_redraw(me);
return 1; /* never animate */
} else if (button == 'u' || button == 'u' ||
button == '\x1A' || button == '\x1F') {
+ midend_stop_anim(me);
if (!midend_undo(me))
return 1;
} else if (button == '\x12') {
+ midend_stop_anim(me);
if (!midend_redo(me))
return 1;
} else if (button == 'q' || button == 'Q' || button == '\x11') {
@@ -199,6 +206,7 @@ int midend_process_key(midend_data *me, int x, int y, int button)
midend_redraw(me);
return 1;
} else if (s) {
+ midend_stop_anim(me);
while (me->nstates > me->statepos)
free_game(me->states[--me->nstates]);
ensure(me);