From a01c40b35ad08a45f7453c03ef0d493cd97408a9 Mon Sep 17 00:00:00 2001 From: mattn Date: Wed, 9 Jul 2014 19:23:12 +0900 Subject: [PATCH] 'p' to pause --- autoload/flappyvird.vim | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/autoload/flappyvird.vim b/autoload/flappyvird.vim index b96f931..f9df47c 100644 --- a/autoload/flappyvird.vim +++ b/autoload/flappyvird.vim @@ -97,15 +97,22 @@ function! s:loop() call setline(sh + 2, printf(" SCORE: %6d", 0)) + let pause = 0 let retry = 0 while 1 let c = getchar(0) - if c == 27 || c == 113 " esc or q + if c == 27 || c == 113 " esc or q to quit " quit loop break + elseif c == 112 " p to pause + let pause = !pause + endif + + if pause + continue endif if state == s:STATE_FINISH - if c == 114 " r + if c == 114 " r to retry let retry = 1 break endif