From 8d61d19bde3789c56995584348b57cf263f4a2c9 Mon Sep 17 00:00:00 2001 From: "Alex A. Naanou" Date: Thu, 20 Apr 2017 23:46:09 +0300 Subject: [PATCH] added 'paused' indicator... Signed-off-by: Alex A. Naanou --- simplesnake/simplesnake.appcache | 2 +- simplesnake/simplesnake.css | 15 +++++++++++++++ simplesnake/simplesnake.js | 2 ++ 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/simplesnake/simplesnake.appcache b/simplesnake/simplesnake.appcache index 468b3f0..009255d 100755 --- a/simplesnake/simplesnake.appcache +++ b/simplesnake/simplesnake.appcache @@ -1,5 +1,5 @@ CACHE MANIFEST -# Timestamp: 20170420232958 +# Timestamp: 20170420234350 CACHE: simplesnake.html diff --git a/simplesnake/simplesnake.css b/simplesnake/simplesnake.css index 55c2b97..65891bb 100755 --- a/simplesnake/simplesnake.css +++ b/simplesnake/simplesnake.css @@ -90,6 +90,21 @@ body { background-color: red; } +.simplesnake.stopped:before { + content: "Paused..."; + position: absolute; + display: block; + width: 100%; + top: 50%; + margin-top: -10vmin; + font-size: 10vmin; + font-weight: bolder; + text-align: center; + color: rgba(0, 0, 0, 0.2); + z-index: 100; +} + + /* .simplesnake .apple { position: relative; diff --git a/simplesnake/simplesnake.js b/simplesnake/simplesnake.js index 502fd33..df0b24f 100755 --- a/simplesnake/simplesnake.js +++ b/simplesnake/simplesnake.js @@ -287,6 +287,7 @@ var Snake = { .snakeKilled(null) }, start: function(t){ + this._field.classList.remove('paused') this.__timer = this.__timer || setInterval(this._tick.bind(this), t || this.config.interval || 200) // reset player control actions... @@ -297,6 +298,7 @@ var Snake = { return this }, stop: function(){ + this._field.classList.add('paused') clearInterval(this.__timer) delete this.__timer delete this.__tick