don't set dirty on mousemove unless button is down.

This commit is contained in:
Rob Pearce 2016-08-26 16:31:38 +10:00
parent 9941dfa1fa
commit 4db6dd2c5f
2 changed files with 8 additions and 2 deletions

View File

@ -52,6 +52,8 @@ var curlevel = 1;
var lastmx = -1, lastmy = -1;
var mbdown = false;
var FLASHSPEED = 0.05;
@ -3237,6 +3239,9 @@ console.log("lev " + lev + " newwid " + newwid + " ratio " + ratio);
handlemousedown : function(event) {
var coords,adjustx,adjusty,realx,realy;
event.preventDefault();
mbdown = true;
coords = getmousexy(event);
adjustx = coords[0];
adjusty = coords[1];
@ -3413,6 +3418,7 @@ console.log("lev " + lev + " newwid " + newwid + " ratio " + ratio);
event.preventDefault();
if (!mbdown) return;
if (game.state != "running") return;
game.dirty = true; // need to redraw
@ -3458,6 +3464,8 @@ console.log("lev " + lev + " newwid " + newwid + " ratio " + ratio);
event.preventDefault();
mbdown = false;
if (game.state != "running") return;
game.dirty = true; // need to redraw

2
todo
View File

@ -32,8 +32,6 @@ https://www.smashingmagazine.com/2012/10/design-your-own-mobile-game/
----------
*use image instead of unicode for yellow stars.
----------