PhoneGap游戏,画布和缓慢的javascript [英] PhoneGap games, canvas and slow javascript

查看:124
本文介绍了PhoneGap游戏,画布和缓慢的javascript的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以我建立了我希望会成为一个简单的安卓游戏。我首先创建了一个网络版本( http://scolvin.com/ballgame ),然后将其移至PhoneGap和使用加速度计来控制游戏。唯一的问题(它是一个显示停止问题)是结果是可怕的慢(更新我猜一次一秒钟,而不是20ms ish)。



只是怎么慢phonegap是,没有当前的解决方案?



这个游戏使用easeljs和box2d-web。



奇怪的是,它似乎在Android Chrome上以合理的速度运行,但是在Android的浏览器(我似乎记得是基于firefox?)和phonegap很可能使用相同的html renderer / js中断。 / p>

我已经尝试简化游戏,尽可能多地使用 setInterval ,而不是<$

解决方案

这是Android的问题浏览器



请参阅以下答案:



Sencha Touch 2 - Android性能



(这是Sencha Touch,点的答案是一样的)


So I built what I hoped would become a simple android game. I first built a web version to getting it working (http://scolvin.com/ballgame) then moved it to PhoneGap and used accelerometers to control the game. The only problem (and it's a show stopping problem) is that the result is horrifically slow (updates i guess about once a second instead of ever 20ms ish).

Is this just how slow phonegap is, with no current solution? Or is there some golden bullet I'm missing?

The game uses easeljs and box2d-web.

What's odd is it seems to run at a reasonable speed on android chrome, but very slow on android's "browser" (which I seem to recall is based on firefox?) and in phonegap which presumably uses the same html renderer/js interrupter.

I've tried simplifying the game, getting rid of as much as i can, using setInterval rather than accelerometer.watchAcceleration all to no avail.

解决方案

It's a problem of the Android Browser

See the following answer:

Sencha Touch 2 - Android Performance

(It's for Sencha Touch, but i think the main points of the answer are the same)

这篇关于PhoneGap游戏,画布和缓慢的javascript的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆