Cocos2d-x和cocos2d-android对于一个Android游戏 [英] Cocos2d-x vs cocos2d-android for an Android game

查看:71
本文介绍了Cocos2d-x和cocos2d-android对于一个Android游戏的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的一个项目中使用了"cocos2d-iphone"之后,我试图确定我应该在Android游戏中使用哪种口味的Cocos2d.我的个人利弊清单:

After using 'cocos2d-iphone' in one of my projects, I am trying to decide which flavor of Cocos2d I should use for an Android game. My personal list of pros and cons:

Cocos2d-x

专业人士: :将游戏稍后发布到iOS(可能还有其他平台)应该更容易

pros: it should be easier to bring the game to iOS later, potentially other platforms as well

缺点/问题: :在Android上调试c ++代码(方便与否?),NDK应用程序与各种Android设备的兼容性(有多大的问题?),访问特定于平台的功能(应用内购买等)

cons/doubts: debugging c++ code on Android (easy or not?), compatibility of NDK app with various Android devices (how much of a problem?), accessing platform-specific functionality (in-app purchases, etc.)

cocos2d-android

优点: 所有Java,更易于设置和访问平台特定的功能

pros: all Java, easier to setup and access platform-specific functions

缺点: 将必须从Java转换为其他平台的c ++或Objective-C

cons: will have to translate from Java to either c++ or Objective-C for other platforms

我没有想到的任何一个选项是否还有其他问题?如果有人必须做出选择,那么您选择了什么,为什么?

Are there other issues with either of the options that I didn't think about? If anybody had to make this choice, what did you choose and why?

推荐答案

请注意,有两个名称几乎相同的项目:cocos2d-android和cocos2d-android * 1 *.后者是前者的一个分支,它的作者之所以这样做是因为cocos2d-android项目几乎已经死了.

Note that there are two projects with almost the same name: cocos2d-android and cocos2d-android*1*. The latter is a fork of the former and its author did it because cocos2d-android project was almost dead.

一开始,我对cocos2d-android1(这似乎是一个很好的作品)和cocos2d-x表示怀疑,但是我可能会喜欢用C ++进行开发并且可以跨平台使用,因此我选择了cocos2d-x.

In the beginning I was in doubt about cocos2d-android1 (which seems to be a very good work) and cocos2d-x but the possibility to develop in C++ (that I like a lot) and be multi-platform made me chose cocos2d-x.

我仍在尝试学习cocos2d-x.

I'm still trying to learn cocos2d-x.

我喜欢它:

  • 列表项

  • List item

这是一个C ++框架

您可以为Android,iPhone,Bada,Blackblerry Playbook,Windows和Linux开发.请注意,目前cocos2d-x团队建议Windows和Linux端口是为了简化您的开发而不是将其投入生产.

you can develop for Android, iPhone, Bada, Blackblerry Playbook, Windows and Linux. Please, notice that at the moment cocos2d-x team advises that Windows and Linux port are meant for easy your development not for production.

它具有Lua绑定

它具有用于果酱(付费的多平台SDK)的版本

it has a version for Marmalade (a paid multi-platform SDK)

cocos2d-x从发行版4开始就与NDK一起使用.目前,我正在使用NDK r7.您可以针对自android 2.1(API 7)起运行的设备进行开发

cocos2d-x works with NDK since release 4. Currently I'm using NDK r7. You can develop for devices running since android 2.1 (API 7)

似乎android 4上的cocos2d-x存在一些问题(这不应该是一个问题,因为两者仍然没有那么广泛,cocos2d-x团队将解决他们遇到的任何问题).

It seems that there are some issues with cocos2d-x on android 4 (what shouldn't be a problem because both it's still not that wide spread and cocos2d-x team will fix any problem they come across).

您将能够访问特定于平台的功能,例如应用程序内购买,但价格不菲:您几乎可以使用JNI进行所有操作.

You will be able to access platform specific functionality like in-app purchase but it comes with a price: you will do almost everything using JNI.

绝对不只是将jar SDK放入libs文件夹中并直接调用Java函数,但还是可行的.

Definitely it's harder than just putting a jar SDK into libs folder and directly call Java functions but it's feasible.

您可以在Windows,Linux或Mac上进行开发.对于开发机器中使用的每个OS,准备环境的过程(cocos2d-x +目标SDK)各不相同.这不是问题,因为您通常会坚持使用其中一个.

You can develop on Windows, Linux or Mac. For each OS you're using in the development machine the procedures to prepare your environment (cocos2d-x + target SDKs) varies. It's not a problem because you usually will stick with one of them.

现在让我告诉您,调试JNI/Java代码并不是那么容易.为什么?因为必须执行许多步骤才能启用此功能,所以调试过程很慢.

Now let me tell you that it's not that easy to debug JNI / Java code. Why? Because there are many steps you must take to enable this and debugging process is slow.

因此,cocos2d-x团队建议您开发适用于Linux或Windows的所有游戏,然后一切就绪并运行,然后将其编译为Android.这样,您就可以解决一些小问题(如果有的话)

So that cocos2d-x team advices to develop all your game for Linux or Windows and after that everything is up and running you compile it to Android. This way you will have minor problems to solve (if any)

我更喜欢从一开始就为Android开发.

I prefer to develop for android from the beginning.

总而言之,我非常高兴使用cocos2d-x进行编码.社区非常热衷于cocos2d-x,他们对此非常支持.

All in all, I'm really happy coding with cocos2d-x. Community is very passionate about cocos2d-x and they are very supportive.

在学习过程中,我编写了两个教程:

In the process of learning I wrote two tutorials:

  • Developing with cocos2d-x for android on Linux, that teaches how to prepare your environment to develop for android using cocos2d-x

如何调试cocos2d-x和使用Eclipse的Java代码详细说明了执行调试会话所需的所有步骤.

How to debug cocos2d-x and Java code using Eclipse that explain in details all needed steps to perform debugging sessions.

致谢.

这篇关于Cocos2d-x和cocos2d-android对于一个Android游戏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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