使用Phaser.js和Ionic开发游戏应用程序(缓慢/抖动渲染) [英] Developing game app using Phaser.js and Ionic (slow/shaky rendering)

查看:306
本文介绍了使用Phaser.js和Ionic开发游戏应用程序(缓慢/抖动渲染)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用Phaser.js开发了一个游戏应用程序。我把代码放入Ionic空白启动应用程序。因此,基本上使用Ionic应用程序渲染视图,然后Phaser通过id获取div并显示游戏。

I developed a game app using Phaser.js. I sort of put the code into Ionic blank starter app. So basically the view is rendered using Ionic app and then Phaser picks up the div by the id and displays the game.

这是一个简单易碎的鸟类克隆。它的工作正常,但块运动有点不稳定(好像它们在颤抖)。由于Phaser使用WebGL,它可能是缓慢渲染的原因还是由于离子框架(/ angularjs)?

Its a simple flappy bird clone. Its working fine but the blocks movement is a bit shaky (as though they were shivering). Since Phaser uses WebGL, could it be the reason for slow rendering or is it due to the ionic framework (/angularjs) ?

我是否应该使用其他一些工具来构建游戏应用程序?

Should I have used some other tools to build the game app?

提前致谢。

您可以在此处查看代码: https://github.com/vamshisuram/ionic-flappybird- clone.git
我将所有代码上传到Git。所以,我想你可以直接在你的手机中安装 platforms / ant-build / Hello-Cordova-debug.apk 并进行测试。或者再次尝试构建并安装。

You can checkout the code here: https://github.com/vamshisuram/ionic-flappybird-clone.git I uploaded all code into Git. So, I guess you can directly install platforms/ant-build/Hello-Cordova-debug.apk into your mobile and test it. Or try build again and install.

推荐答案

你可以使它工作。但是......在使用stock webview的任何Android设备上都不支持WebGL(Ionic使用Cordova打包应用程序,然后在设备上的webview中运行): http://caniuse.com/#feat=webgl

You can make it work. BUT ... there is no support for WebGL on any Android device using the stock webview (Ionic uses Cordova to package the app which is then being run inside a webview on the device): http://caniuse.com/#feat=webgl

Phaser.js建立在Pixie.js之上这将回退到2D画布渲染。这就是你的游戏运行缓慢的原因。

Phaser.js is built on top of Pixie.js which will fall back to 2D canvas rendering. That's why your game is running slow.

如果你想使用Ionic和WebGL,你应该使用CrossWalk构建您的应用。我已经做到了,它很棒: https://crosswalk-project.org/

If you want to use Ionic and WebGL you should build your app using CrossWalk. I have done that and it is awesome: https://crosswalk-project.org/

还有其他选项如CocoonJS可以让WebGL继续运行,但我自己并没有使用它们。

There's other options such as CocoonJS to get WebGL going, but I haven't used those myself.

这篇关于使用Phaser.js和Ionic开发游戏应用程序(缓慢/抖动渲染)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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