我嘗試Crafty.js做一些基本的遊戲和它完美的作品在桌面瀏覽器,但填補了移動設備上的整個屏幕。在這裏我的網頁:基本狡猾的遊戲填滿整個屏幕上移動設備
<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>
,最後我的遊戲(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();
}
我嘗試使用視meta標籤,但沒有奏效 同樣在狡猾的入門遊戲.js文件網站已經在移動設備上同樣的問題: http://buildnewgames.com/assets/article//introduction-to-crafty/tut_bng/index.html。
任何想法如何解決它?
嗯,你已經設置了寬度和高度在你的CSS ... – 2013-04-29 23:09:15
我刪除了CSS(抱歉,這是我debuggin的一部分)。但無論如何,CSS設置爲700x400和iPad爲1024x768,這樣不應該填充整個屏幕 – 2013-04-29 23:29:17