Hi Kirupa ,
I having trouble with ‘resizecanvas’.
I am using quick.js .
So far , the only way I can get canvas to resize correctly is by ‘location.reload();’ .
See:
http://liesandcowpies.com/quickjs/BenghaziGame.html
.html pastebin.com/jPaFjcWk
.js pastebin.com/xLcM9G4n
I tried the following code from your article:
See:
http://liesandcowpies.com/quickjs/BenghaziGame-kirupa.html
.html pastebin.com/BfBE7NUW
.js pastebin.com/Qc04CEGt
quick.js pastebin.com/Gzqef5fu
What happens below is that the canvas size is correct ,
but instead of aligned in center , it displays on screen left .
liesandcowpies.com/quickjs/BenghaziGame-kirupa.html
Is there a different approach I can use ?
Thanks…
@ line 250 ( pastebin.com/Qc04CEGt ) :
window.addEventListener('resize', resizeCanvas, false);
function resizeCanvas () {
var myCanvas = document.getElementById('canvas');
// canvasDiv = canvasDiv.align = 'center';
// myCanvas.width = document.documentElement.innerWidth; // .inner* = Black Screen
myCanvas.width = document.documentElement.clientWidth; // .client* = bad canvas align
myCanvas.height = document.documentElement.clientHeight; // .client* = bad canvas align
// myCanvas.height = document.documentElement.innerHeight; // .inner* = Black Screen
Quick.setAutoScale(false);
Quick.setKeepAspect(true);
} //