Cocos2d-x v3.17 released!

I can’t compile android with “cocos compile -p android --android-studio”, “cocos compile -p android --android”, “cocos compile -p android”

I have error:
[armeabi-v7a] Compile++ thumb: cocos2djs_shared <= AppDelegate.cpp
[armeabi-v7a] Compile++ arm : cocos2d_js_static <= jsb_cocos2dx_3d_auto.cpp
[armeabi-v7a] Compile++ arm : cocos2d_js_static <= jsb_cocos2dx_extension_auto.cpp
In file included from E:/HocTap/CocosJsWorkspaces/DownloadResources/frameworks/runtime-src/proj.android/app/jni/…/…/…/…/cocos2d-x/cocos/scripting/js-bindings/proj.android/…/auto/jsb_cocos2dx_3d_auto.cpp:1:
In file included from E:/HocTap/CocosJsWorkspaces/DownloadResources/frameworks/runtime-src/proj.android/app/jni/…/…/…/…/cocos2d-x/cocos/3d/…\scripting/js-bindings/auto/jsb_cocos2dx_3d_auto.hpp:5:
E:/HocTap/CocosJsWorkspaces/DownloadResources/frameworks/runtime-src/proj.android/app/jni/…/…/…/…/cocos2d-x/cocos/scripting/js-bindings/proj.android/…/…/…/…/external/spidermonkey/prebuilt/android/…/…/include/android\jsapi.h:12:10: fatal error: ‘mozilla/FloatingPoint.h’ file not found
#include “mozilla/FloatingPoint.h”
^~~~~~~~~~~~~~~~~~~~~~~~~
In file included from E:/HocTap/CocosJsWorkspaces/DownloadResources/frameworks/runtime-src/proj.android/app/jni/…/…/…/…/cocos2d-x/cocos/scripting/js-bindings/proj.android/…/auto/jsb_cocos2dx_extension_auto.cpp:1:
In file included from E:/HocTap/CocosJsWorkspaces/DownloadResources/frameworks/runtime-src/proj.android/app/jni/…/…/…/…/cocos2d-x/cocos/3d/…\scripting/js-bindings/auto/jsb_cocos2dx_extension_auto.hpp:5:
E:/HocTap/CocosJsWorkspaces/DownloadResources/frameworks/runtime-src/proj.android/app/jni/…/…/…/…/cocos2d-x/cocos/scripting/js-bindings/proj.android/…/…/…/…/external/spidermonkey/prebuilt/android/…/…/include/android\jsapi.h:12:10: fatal error: ‘mozilla/FloatingPoint.h’ file not found
#include “mozilla/FloatingPoint.h”
^~~~~~~~~~~~~~~~~~~~~~~~~

I create project with cmd “cocos new DownloadResources -p com.tunt.downloadresources -l js -d E:
\HocTap\CocosJsWorkspaces”

I using NDK r16b

long path error on Windows platforms, you can move you JS project into E:/ for a temp solution. Some header files is so depth.

Thank you for reply.

I have fix above error because I compile it using NDK R16, after upgrade NDK from R16 to R17, I was compile completed.

That’s amazing, NDK R17 solve this long path issue on windows platform.

Actually r17 doesn’t solve long path issue, if the path length large than 260, the ndk compile system will abort.

what’s the solution for this long path error, should we adapt the struct of folder to avoid this issue?

there is the solution:
https://github.com/halx99/wsLongPaths/blob/master/dists/ndk-wsls-2.1

finally:
Now, this solution now support clang or gcc at windows7 & windows 10 platform.

Android Studio + ndk-r17 + cocos2d-x-3.17 cpp-empty-test:

No patch installed:

With patch installed:

How to install this patch:
1: set env var ANDROID_NDK_ROOT to your ndk-bundle directory
2: right click ndk-wsls-2.0-final/install.bat, run as administrator.

I have attempt to use but it has no effect

I don’t an error while using cocos-2dx v3.16 & ndk r14b

I ran into a problem while running cpp-tests:

After first call to addPhysics3DConstraint(), app crashes on exit

I created an issue on GitHub: https://github.com/cocos2d/cocos2d-x/issues/18864

Help, after i upgrade my cocos2dx version there are 2 error in my code.

1 - No match Function in MenuItemImage::create

auto Setting = MenuItemImage::create("res/Setting.png", "res/SettingP.png",
                                     CC_CALLBACK_1(MenuScene::settingFunc, this));

2 - class ‘std::_bind<bool(intro::*)(Touch *, Event *), intro *, const std::Placeholders::_ph<1> &, const std::placeholders::_ph<2>’ is not compatible with class EventlistenerTouchOnebyOne::ccTouchBegan

auto listener = EventListenerTouchOneByOne::create();
listener->setSwallowTouches(true);
listener->onTouchBegan = CC_CALLBACK_2(intro::onTouchBegan, this);  //error
this->getEventDispatcher()->addEventListenerWithSceneGraphPriority(listener, this);

in bool onTouchBegan :

bool intro::onTouchBegan(cocos2d::Touch *touch, cocos2d::Event *event) {
if (ss == 0) {
    starts();
    ss++;
}
return true;

}

in starts:

void intro::starts() {
auto scene = MenuScene::createScene();
Director::getInstance()->pushScene(scene);

}

I tried that, but it didn’t work. I wonder if my whole AppDelegate code (which is several years old) is wrong. I’m going to try this next:

@slackmoehrle and @bilalmirza, my project dates back a few years, and is now on cocos2d-x 3.16, and I’m not using the storyboard. I am trying to use xassets now, but even when I add a correctly sized iphonex image in the launch images, it starts up smaller.

Ok, this post may be long, so here are the highlights:

  • I use an older approach, where I have different images (folders) for different size devices
  • my project is using 3.16
  • I’m trying to add xassets for the icons and launch images
  • tried adding an iPhoneX-sized launch image, but my application still comes up with a glview of the size of an iPhone 5

I have code at the top of AppDelegate::applicationDidFinishLaunching()

auto director = Director::getInstance();
auto glview = director->getOpenGLView();
CCLOG("getWinSize width is %f", directory->getWinSize().width);
if (!glview)
{
    glview = GLViewImpl::create("PSF");
    CCLOG("created glview, %f x %f", glview->getFrameSize().width,  glview->getFrameSize().height);
}

BTW, because I created my initial project back when we had to include the iPhone 4 (non-retina), I don’t have the “designResolutionSize” approach, but rather I created separate images for iphone, iphonehd, iphone5 (wider), ipad, and ipadhd, and use redDirOrder.push_back() with folders, and glview->setDesignResolutionSize(width, ht, policy) rather than director->setContentScaleFactor()

Because of that, I don’t know how easy it would be to retrofit whatever the iPhoneX and iphone8 fix is into my project?

thanks

Hey, all, I found a partial answer (so far, so good) for getting my 3.16 app to launch on iPhoneX. However, I now need to do a lot of work to get my UI ratios to work, but I think it’s doable.

I’m sharing this here in case it helps anyone else. This is if you’re not using storyboard or xassets. Basically, it uses the naming convention.

2 Likes

well, shoot, I jumped the gun. I was so excited to see my game up in the correct size (and using a new home screen that I created in iPhoneX resolution), that I didn’t notice that the initial screen is the old cocos screen, which baffles me, because I don’t see it anywhere in my project.

I’m going to keep working on it, but I have a question. When I start the simulator, this is the sequence:

  1. show the full cocos screen with gray background (which I never had in this project to the best of my knowledge),
  2. then show a small image of mine, which is usually full screen, so I’m guessing I need to find and resolve that,
  3. finally show my actual home screen.

So … it seems that me providing an image of the right size was enough to trigger iPhoneX, but it’s not using that image!

Anywho, I’m going to track this down.

There are a few threads about iPhone X sizing. I will work on an answer too.

1 Like

@dogwalker Just use a Launch screen in Userinterface, its simple as it gets… xcode has the option

1 Like

I’m gonna try this too today. Good thought XCode 9? or 10?

Im using 9

Yeah, note that my solution is intended for games that don’t want or can’t easily conform to the new interface guidelines for the iPhone X.

e.g. we don’t want the notch to cut off our left-side menu so we used this code to letterbox our game (possibly with tweaks due to issues, but I think it was updated after fixed issues), such that it displays within the safe area insets of the notched device(s).

There’s likely aspects not included, such as requiring launch screen .xib (or correct added default launch images) and other required changes for all iOS apps outside cocos2d changes.