Cocos2d-x V4.0 released

There is an upgrade guide

You can support both v3 and v4 with the same code. I have a relatively large project that is compatible with v3.17 and v4, with minor version-specific code in it.

The biggest issue would be any custom shaders, and it’s more than likely you would need two sets of those shaders, one for v3, and another for v4.

The game project CMakeLists.txt needs to be modified so it can be used for both versions as well.

1 Like

still can i use android.mk for configuration?

1 Like

Yes this is great advice. I have a project that is v4 on iOS and v3.17 on all other platforms.

1 Like

Does anyone know how to add push notification capabilities to the xcode project generated by cmake?
I’m refering to this:

I tried the following with no success:
set_property(TARGET target XCODE_ATTRIBUTE_PUSH_NOTIFICATIONS YES)
and
set_xcode_property(${APP_NAME} PUSH_NOTIFICATIONS "YES")

Googling hasn’t been of much help.

I need to upgrade one of my projects to v4.

  1. I’ve noticed that installing v4 writes a few lines to .bash_profile. Will that impact my other existing v3 projects?
  2. I’ve red that with v4 I MUST work with cmake. Is there a way around this? Once I install cmake, can I keep working in the normal way in my other v3 projects or will this impact all my existing projects?
    Thanks,

V4 can generate Xcode, VS, android studio projects and you can use these as expected.

V3 writes lines to bash_profile too.

Installing CMake doesn’t change anything. You can install multiple versions of Cocos2d-x side-by-side, but you can only use one at a time. On Windows, you can create a symbolic link to the version of Cocos2d-x you want to use, and I assume you can do this for Linux as well.

For example, say you have 2 installations, v3 and v4, as follows:

/path/to/cocos/cocos2dx_v3
/path/to/cocos/cocos2dx_v4

What you do is create a symbolic link to the one you want to use to generate a project with, for example, if you want to use v4:

ln -s /path/to/cocos/cocos2dx_v4 /path/to/cocos/cocos2dx

So now you have the following:

/path/to/cocos/cocos2dx -> /path/to/cocos/cocos2dx_v4
/path/to/cocos/cocos2dx_v3
/path/to/cocos/cocos2dx_v4

I assume the .batch_profile has some paths set in it, so make sure you change them to point to /path/to/cocos/cocos2dx

If symbolic links don’t work, then try hard links instead.

1 Like

Symlinks rule all. Best invention ever.

Any one knows?
Running into the same issue when I want to add the iCloud capability.

edit: I’ve done the following to integrate iCloud capability.
Go to your xcodeproj file, select your target -> signing & capabilities. Here you can manually add the iCloud capability and configure it. This will create an .entitlements file which you can load with CMake like this:

set_target_properties(${APP_NAME} PROPERTIES XCODE_ATTRIBUTE_CODE_SIGN_ENTITLEMENTS "${CMAKE_CURRENT_LIST_DIR}/yourentitlementsfile.entitlements")

1 Like

I’m in similar situation.

I posted my problem here.

I want to know how to build iOS app for archive with Xcode.

If I set “Build Active Architecture Only” from “Yes” to “No” in Build Settings, It causes Undefined symbols for architecture errors.

Does anyone know how to fix it?

I changed “Build Active Architecture Only” from “Yes” to “No” in not only my game TARGET, but also PROJECT and all the TARGETS (cocos2d, ext_clipper, ext_convertUTF, ext_edtaa3func, ext_md5, ext_poly2tri, ext_recast, ext_tinyxml2, ext_unzip, ext_xxxhash, ext_xxtea, external), then it worked.

Thank you.

1 Like

There is issue in Label::draw(…)


All symbols are placed in _batchNodes[1], and ‘return’ in this place cause to the Label could not be drawn.
I caught the issue when changed Label string content (from one language to another, but withing one .ttf).
The Label is drawn normal if set ‘continue’ instead of ‘return’.

PS.
There is no such issue in halx99 fork : https://discuss.cocos2d-x.org/t/engine-x-a-game-engine-which-is-based-on-cocos2d-x-4-0/48403/65

He reimplemented Label in this part, and it works good for me.

It’s already been reported on the cocos2d-x github repo and a PR submitted here.

Very good! Thank you to let me know.

@slackmoehrle How about release v4.1 & v3.17.3 with latest submitted PRs and latest iOS/xcode support out of the box? So we dont have to manually edit any cmake file or anything else.

I’ll talk to the team.

Any chance we’ll get apple m1 support in the prebuilt libraries?

We aren’t putting out a new release quite yet. We plan to collect and address v4 issues in a future build.

2 Likes

Could somebody explane, why there is provided ES_AUTOHSCROLL flag for EditBox on Windows, but is not provided ES_AUTOVSCROLL ? It can be usefull in some cases to have opportunity to scroll vertically.