Android 游戏的 Cocos2d-x 与 cocos2d-android

发布于 2024-12-20 16:37:44 字数 567 浏览 3 评论 0原文

在我的一个项目中使用“cocos2d-iphone”后,我试图决定应该在 Android 游戏中使用哪种风格的 Cocos2d。我个人的优点和缺点列表:

Cocos2d-x

优点:以后将游戏带到 iOS 上应该会更容易,可能还有其他平台以及

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

cocos2d-android

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

缺点:< /em> 必须从 Java 转换为 C++ 或 Objective-C 以用于其他平台。

这两个选项是否还有其他我没有考虑到的问题?如果有人必须做出这样的选择,你会选择什么?为什么?

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

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

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

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

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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

萤火眠眠 2024-12-27 16:37:44

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

一开始我对cocos2d-android1(这似乎是一个非常好的作品)和cocos2d-x有疑问,但是用C++开发(我非常喜欢)和多平台的可能性使我选择了cocos2d-x 。

我还在努力学习cocos2d-x。

我喜欢它的原因:

  • 列表项

  • 它是一个 C++ 框架

  • 您可以为 Android、iPhone、Bada、Blackblerry Playbook、Windows 和Linux。
    请注意,目前 cocos2d-x 团队建议 Windows 和 Linux 端口是为了方便您的开发而不是为了生产。

  • 它有一个 Lua 绑定

  • 它有一个 Marmalade(付费多平台 SDK)版本

cocos2d-x 自版本 4 起可与 NDK 配合使用。目前我使用的是 NDK r7。您可以为自 android 2.1 (API 7) 以来运行的设备进行开发

似乎在 android 4 上 cocos2d-x 存在一些问题(这应该不是问题,因为它仍然没有那么广泛传播,并且 cocos2d-x 团队将修复他们遇到的任何问题)。

您将能够访问特定于平台的功能,例如应用内购买,但它是有代价的:您将使用 JNI 完成几乎所有操作。

当然,这比直接将 jar SDK 放入 libs 文件夹并直接调用 Java 函数要困难,但也是可行的。

您可以在 Windows、Linux 或 Mac 上进行开发。对于您在开发计算机中使用的每个操作系统,准备环境(cocos2d-x + 目标 SDK)的过程有所不同。这不是问题,因为您通常会坚持使用其中之一。

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

因此,cocos2d-x 团队建议为 Linux 或 Windows 开发所有游戏,然后一切准备就绪并运行,然后将其编译到 Android。这样你就会有一些小问题需要解决(如果有的话)

我更喜欢从一开始就为android开发。

总而言之,我很高兴使用 cocos2d-x 进行编码。社区对 cocos2d-x 非常热情,并且非常支持。

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

问候。

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.

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.

I'm still trying to learn cocos2d-x.

What I like about it:

  • List item

  • it's a C++ framework

  • 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.

  • it has a Lua binding

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

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)

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).

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.

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

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.

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.

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)

I prefer to develop for android from the beginning.

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:

Regards.

烛影斜 2024-12-27 16:37:44

2个月前我也遇到了同样的问题。 Cocos2d-Android 已经死了,所以使用 cocos2d-x。 这里一些开始使用它的链接和教程。

I had the same problem 2 month ago. Cocos2d-Android is dead, so use cocos2d-x. Here some links and tutorials to start using it.

饭团 2024-12-27 16:37:44

如果您熟悉 C/C++,请务必选择 Cocos2d-x 路线。
然而,如果您有 Android 和 Java 背景,没有 C++ 经验,那么让一切井井有条可能是一次非常痛苦的经历。
由于 Cocos2D for Android 项目最近进展缓慢,我不会特别说它已经死了。我在这里使用了github上托管的版本..
https://github.com/ZhouWeikuan/cocos2d

有几个入门教程。

如何在 Android 版 Cocos2d 中构建您的第一个滑块拼图游戏的分步指南 – 第 1 部分 http://denvycom.com/blog/step-by-step-guide-on-how-to-build-your-first-slider-puzzle-game-in-cocos2d-for-android- part-1/

如何使用 Cocos2D 制作简单的 Android 游戏 http://dan.clarke。 name/2011/04/how-to-make-a-simple-android-game-with-cocos2d/

对于所有其他来到这个帖子的人,我希望这有用!

If you are comfortable with C/C++ , by all means go the Cocos2d-x route.
HOWEVER, if you are coming from an Android and Java background, with no experience in C++ , it can be a really painful experience getting everything in order.
In asmuch as the Cocos2D for Android Project has been slow recently, I wont particularly say its dead. I used the version hosted on github here ..
https://github.com/ZhouWeikuan/cocos2d

There are several tutorial on getting started.

Step by Step Guide on How to build your first Slider Puzzle game in Cocos2d for Android – Part 1 http://denvycom.com/blog/step-by-step-guide-on-how-to-build-your-first-slider-puzzle-game-in-cocos2d-for-android-part-1/

How To Make A Simple Android Game with Cocos2D http://dan.clarke.name/2011/04/how-to-make-a-simple-android-game-with-cocos2d/

For all others coming to this thread, I hope this is useful!

错々过的事 2024-12-27 16:37:44

cocos2d-x(98% 的 C++ 和一些 Android Java 代码)是 cocos2d 唯一有用的版本安卓。

如果您想创建一些原型,cocos2d Android(所有 Java)可能会很有用,但是作为一个活跃的开源开发项目,它早已消亡且无人维护。

如果您想在 Android 上编写 Java 游戏,请使用 AndEngine - 它很活跃且维护良好。

cocos2d-x (98% in C++ and some Android Java Code) is the only version of cocos2d useful for Android.

cocos2d Android (all Java) may be useful if you want to create some prototypes, but as an active open source development project it is long dead and not maintained.

If you want to write a Java game on Android, use AndEngine - it is active and well maintained.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文