Skip to content
Snippets Groups Projects
Commit babf8ab5 authored by rswindell's avatar rswindell
Browse files

Use Math.ceil() - round up - for vertical 'center' position of draw() and

drafx() methods. For consistency with how Minesweeper vertically centers its
game board.
parent 5f48131f
No related branches found
No related tags found
No related merge requests found
...@@ -557,7 +557,7 @@ Graphic.prototype.draw = function(xpos,ypos,width,height,xoff,yoff,delay) ...@@ -557,7 +557,7 @@ Graphic.prototype.draw = function(xpos,ypos,width,height,xoff,yoff,delay)
if(xpos==undefined || xpos < 1) if(xpos==undefined || xpos < 1)
xpos=1; xpos=1;
if(ypos == 'center') // center if(ypos == 'center') // center
ypos = Math.floor((console.screen_rows - height) / 2) + 1; ypos = Math.ceil((console.screen_rows - height) / 2) + 1;
if(ypos==undefined || ypos < 1) if(ypos==undefined || ypos < 1)
ypos=1; ypos=1;
if(delay==undefined) if(delay==undefined)
...@@ -619,7 +619,7 @@ Graphic.prototype.drawfx = function(xpos,ypos,width,height,xoff,yoff) ...@@ -619,7 +619,7 @@ Graphic.prototype.drawfx = function(xpos,ypos,width,height,xoff,yoff)
if(xpos == 'center') // center if(xpos == 'center') // center
xpos = Math.floor((console.screen_columns - width) / 2) + 1; xpos = Math.floor((console.screen_columns - width) / 2) + 1;
if(ypos == 'center') // center if(ypos == 'center') // center
ypos = Math.floor((console.screen_rows - height) / 2) + 1; ypos = Math.ceil((console.screen_rows - height) / 2) + 1;
if(xoff+width > this.width || yoff+height > this.height) { if(xoff+width > this.width || yoff+height > this.height) {
alert("Attempt to draw from outside of graphic: "+xoff+":"+yoff+" "+width+"x"+height+" "+this.width+"x"+this.height); alert("Attempt to draw from outside of graphic: "+xoff+":"+yoff+" "+width+"x"+height+" "+this.width+"x"+this.height);
return(false); return(false);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment