
Originally Posted by
CruddyBuddy
Do you know where you bought the resizing script? I would pay for something like that. The apps I work with are published on client websites, not game websites, so I would need something I can use to edit the index.html.
Try this code to play with an old source ;
Code:
(function resizeGame() {
var gameArea = document.getElementById('MMFCanvas');
var widthToHeight = window.innerWidth / window.innerHeight; // OR 4/3 ratio or 6.4/4.8 if you have 640*480
var newWidth = window.innerWidth;
var newHeight = window.innerHeight;
var newWidthToHeight = newWidth / newHeight;
if (newWidthToHeight > widthToHeight) {
newWidth = newHeight * widthToHeight;
gameArea.style.height = newHeight + 'px';
gameArea.style.width = newWidth + 'px';
} else {
newHeight = newWidth / widthToHeight;
gameArea.style.width = newWidth + 'px';
gameArea.style.height = newHeight + 'px';
}
window.addEventListener('resize', resizeGame, false);
window.addEventListener('orientationchange', resizeGame, false);
})();
This code is self run code this mean it's running it self; the canvas element MMFCanvas is just under body not on MMFDiv;