I am trying out Crafty.js to do some basic games and it works perfectly on desktop browsers but fills up the entire screen on mobile devices. Here my webpage:
<html>
<head>
<title>Game</title>
<script src="/javascripts/crafty.js" type="text/javascript">
</script>
<script src="/javascripts/homeGame.js" type="text/javascript">
</script>
</head>
<body style="margin:0 0">
<div id="cr-stage"></div>
</body>
</html>
and finally my game (homegame.js):
window.onload = function() {
Game = {
// Initialize and start our game
start: function() {
// Start crafty and set a background color so that we can see it's working
Crafty.init(480, 320);
Crafty.background('#2d3d4b');
}
}
Game.start();
}
I tried using the viewport meta tag but that didn't work Also the getting started game on the crafty.js website has the same problem on mobile devices: http://buildnewgames.com/assets/article//introduction-to-crafty/tut_bng/index.html.
Any ideas how to fix it?