Cocos2d-x: possible to use HTML (UIWebView)?

我怕爱的太早我们不能终老 提交于 2019-12-06 04:38:05

问题


I'm trying out cocos2d-x and got to the point where I can build the Javascript samples for Android and run them inside a browser as well.

Now I want to create my own game, but coming from a HTML background, I'd rather use HTML tags with CSS than use Javascript to setup the user interface.

I've read about UIWebView which can display HTML-pages in an app, but I was wondering if anyone has ever done this in combination with Cocos2D-x ? And could this be transparent, to overlay a normal cocos2d-x screen in the app then? If so, how could this be done?


回答1:


You can use CCXWebview for that with Cocos2d-x. This extension is based on Cocos2d-x 2.0.4 and it seems to work also on Cocos2d-x 2.x with some modification.

However, if you want to use Cocos2d-x 3.0 for Android, you cannot use it because Cocos2d-x 3.0 uses NativeActivity, thus you cannot combine Android WebView on the Cocos2d-x screen.

EDITED

only problem is that I have little knowledge of Java or C++ ... It would take me years to figure the Java and C++ things out :)

So why are you sticking to use Cocos2d-x??? Why don't you use Cocos2d-html5? It has same functionality as Cocos2d-x JavaScript binding and it uses HTML5 Canvas, so you can use DOM with it.

https://twitter.com/hyperandroid/status/311534580962295809 :

Cocoonjs can run Cocos2d-html5 games too.



来源:https://stackoverflow.com/questions/20886808/cocos2d-x-possible-to-use-html-uiwebview

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!