現在、PhoneGap を使用してゲームを作成しており、Adobe PhoneGap Build を介してゲームをデプロイしようとしました。しかし、Android フォンでアプリを開くと、真っ白な画面しか表示されませんでしたが、Ripple Emulator ではすべての要素 (画像、オーディオ、加速度計、タッチ イベント) が完全に表示されました。アプリの最初の画面は、ウェルカム画像 (img/*.jpg からインポート) といくつかのタッチ イベント (押されたボタンの検証用) である必要があります。
これがindex.htmlの私のコードです
var hello=new Image();
var state = "start";
function draw(){
switch(state)
{
case 'start' :
drawStart();
break();
...
}
requestAnimationFrame(draw);
}...
関数 drawStart() コード...
function drawStart(){
alert("drawStart called"); //just a test
var canvas=document.getElementById('canvas');
var ctx = canvas.getContext('2d');
ctx.font="50px Georgia"; //just a test
var text1width = ctx.measureText("Labyrinth").width; //just a test
ctx.fillText("Labyrinth",(canvas.width/2)-(text1width/2) ,canvas.height/2 - 100); //just a test
hello.src="img/Hello.jpg";
ctx.drawImage(hello,0,0);
};
そして体…
<body>
<script>
$(window).on('load',function(){
draw();
});
</script>
<canvas id="canvas" height="800" width="480">
</canvas>
</body>
アラートとコンテキスト描画関数を drawStart 関数に入れましたが、Android フォンにも表示されませんでした。何が問題で、これを修正するにはどうすればよいですか?