Quantcast
Viewing all 2747 articles
Browse latest View live

Cocos2d-x Android Immersive mode setup instruction

@energyy wrote:

We spent some time making it work for cocos2d-x correctly. So now it works for us and should work for you!:)

1) Edit AppActivity.java

  @Override
    public void onCreate(Bundle savedInstanceState) {

     super.onCreate(savedInstanceState);
     hideSystemUI();
}

....

 @TargetApi(Build.VERSION_CODES.KITKAT)
  private void hideSystemUI() {
             if (Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.KITKAT)
                {
                    getWindow().getDecorView().setSystemUiVisibility(5894);
                    return;
                } else
                {
                    getWindow().getDecorView().setSystemUiVisibility(257);
                    return;
                }
   }

....

@Override
public void onWindowFocusChanged(boolean hasFocus) {
    super.onWindowFocusChanged(hasFocus);

    if (hasFocus){
        hideSystemUI();
    }
}

....

public Cocos2dxGLSurfaceView onCreateView()
{
    glSurfaceView = new Cocos2dxGLSurfaceView(this);
    glSurfaceView.setEGLConfigChooser(5, 6, 5, 0, 16, 8);

    return glSurfaceView;
}

2) Modify Androidmanifest.xml

    <activity android:configChanges="orientation|keyboardHidden|screenSize" android:label="@string/app_name" android:name="org.cocos2dx.cpp.AppActivity" android:screenOrientation="portrait" android:theme="@android:style/Theme.NoTitleBar.Fullscreen" android:windowSoftInputMode="stateVisible|adjustResize">

android:windowSoftInputMode="stateVisible|adjustResize" this part is required

Posts: 1

Participants: 1

Read full topic


Cocos2d-x 3.10 on Windows 10 setup for Android NDK-11c issue

@energyy wrote:

I'm now trying to setup android project on windows machine and stuck with compile.
It seems latest NDK 11c is not somehow compatible with cocos, on Mac we created Readme.txt with NDK version and it worked, but on windows this workaround not working.

Can you advice how to fix that compile issue:

C:\Users\Developer\Desktop\ndktestcocos>cocos run -p android
Building mode: debug
Using Eclipse project : C:\Users\Developer\Desktop\ndktestcocos\proj.android
Android platform not specified, searching a default one...
running: '"C:\Developer\android-sdk\tools\android" update project -t android-15 -p C:\Users\Developer\Desktop\ndktestcocos\proj.android'

Updated project.properties
Updated local.properties
Updated file C:\Users\Developer\Desktop\ndktestcocos\proj.android\proguard-project.txt
Android platform not specified, searching a default one...
running: '"C:\Developer\android-sdk\tools\android" update lib-project -p C:\Users\Developer\Desktop\ndktestcocos\cocos2d\cocos\platform\android\java -t android-15'

Updated project.properties
Updated local.properties
Updated file C:\Users\Developer\Desktop\ndktestcocos\cocos2d\cocos\platform\android\java\proguard-project.txt
Building native...
NDK build mode: debug
Parse NDK version from file C:\Developer\android-ndk-r11c\RELEASE.TXT failed.
NDK_TOOLCHAIN_VERSION: 4.8
running: '"C:\Developer\android-ndk-r11c\ndk-build" -C C:\Users\Developer\Desktop\ndktestcocos\proj.android -j2 NDK_MODULE_PATH=C:\Users\Developer\Desktop\ndktestcocos\proj.android\../cocos2d;C:\Users\Developer\Desktop\ndktestcocos\proj.android\../cocos2d/cocos;C:\Users\Developer\Desktop\ndktestcocos\proj.android\../cocos2d/external NDK_TOOLCHAIN_VERSION=4.8 NDK_DEBUG=1'

Android NDK: WARNING: APP_PLATFORM android-15 is larger than android:minSdkVersion 9 in ./AndroidManifest.xml
make: Entering directory `C:/Users/Developer/Desktop/ndktestcocos/proj.android'
[armeabi] Compile++      : cocos2dcpp_shared <= main.cpp
[armeabi] Compile++      : cocos2dcpp_shared <= AppDelegate.cpp
process_begin: CreateProcess(NULL, C:/Developer/android-ndk-r11c/build//../toolchains/arm-linux-androideabi-4.8/prebuilt/windows-x86_64/bin/arm-linux-androideabi-g++ -MMD -MP -MF ./obj/local/armeabi/objs-debug/cocos2dcpp_shared/__/__/Classes/AppDelegate.o.d -fno-exceptions -fno-rtti -Ijni/../../Classes -IC:/Developer/android-ndk-r11c/build//../sources/cxx-stl/gnu-libstdc++/4.9/include -IC:/Developer/android-ndk-r11c/build//../sources/cxx-stl/gnu-libstdc++/4.9/libs/armeabi/include -IC:/Developer/android-ndk-r11c/build//../sources/cxx-stl/gnu-libstdc++/4.9/include/backward -IC:/Users/Developer/Desktop/ndktestcocos/proj.android/../cocos2d/cocos/editor-support/cocostudio/.. -IC:/Users/Developer/Desktop/ndktestcocos/proj.android/../cocos2d/cocos/editor-support/cocosbuilder/.. -IC:/Users/Developer/Desktop/ndktestcocos/proj.android/../cocos2d/cocos/3d/.. -IC:/Users/Developer/Desktop/ndktestcocos/proj.android/../cocos2d/cocos/editor-support/spine/.. -IC:/Users/Developer/Desktop/ndktestcocos/proj.android/../cocos2d/cocos/network -IC:/Users/Developer/Desktop/ndktestcocos/proj.android/../cocos2d/cocos/audio/android/../include -IC:/Users/Developer/Desktop/ndktestcocos/proj.android/../cocos2d/cocos/ui/../editor-support -IC:/Users/Developer/Desktop/ndktestcocos/proj.android/../cocos2d/cocos/audio/android/../include -IC:/Users/Developer/Desktop/ndktestcocos/proj.android/../cocos2d/external/flatbuffers/.. -IC:/Users/Developer/Desktop/ndktestcocos/proj.android/../cocos2d/extensions/. -IC:/Users/Developer/Desktop/ndktestcocos/proj.android/../cocos2d/extensions/.. -IC:/Users/Developer/Desktop/ndktestcocos/proj.android/../cocos2d/extensions/GUI/CCControlExtension -IC:/Users/Developer/Desktop/ndktestcocos/proj.android/../cocos2d/extensions/GUI/CCScrollView -IC:/Users/Developer/Desktop/ndktestcocos/proj.android/../cocos2d/cocos/. -IC:/Users/Developer/Desktop/ndktestcocos/proj.android/../cocos2d/cocos/./. -IC:/Users/Developer/Desktop/ndktestcocos/proj.android/../cocos2d/cocos/./.. -IC:/Users/Developer/Desktop/ndktestcocos/proj.android/../cocos2d/cocos/./platform -IC:/Users/Developer/Desktop/ndktestcocos/proj.android/../cocos2d/cocos/./base -IC:/Users/Developer/Desktop/ndktestcocos/proj.android/../cocos2d/cocos/./../external -IC:/Users/Developer/Desktop/ndktestcocos/proj.android/../cocos2d/cocos/./../external/tinyxml2 -IC:/Users/Developer/Desktop/ndktestcocos/proj.android/../cocos2d/cocos/./../external/unzip -IC:/Users/Developer/Desktop/ndktestcocos/proj.android/../cocos2d/cocos/./../external/chipmunk/include/chipmunk -IC:/Users/Developer/Desktop/ndktestcocos/proj.android/../cocos2d/cocos/./../external/xxhash -IC:/Users/Developer/Desktop/ndktestcocos/proj.android/../cocos2d/cocos/./../external/nslog -IC:/Users/Developer/Desktop/ndktestcocos/proj.android/../cocos2d/cocos/./../external/poly2tri -IC:/Users/Developer/Desktop/ndktestcocos/proj.android/../cocos2d/cocos/./../external/poly2tri/common -IC:/Users/Developer/Desktop/ndktestcocos/proj.android/../cocos2d/cocos/./../external/poly2tri/sweep -IC:/Users/Developer/Desktop/ndktestcocos/proj.android/../cocos2d/cocos/./../external/clipper -IC:/Users/Developer/Desktop/ndktestcocos/proj.android/../cocos2d/external/websockets/prebuilt/android/../../include/android -IC:/Users/Developer/Desktop/ndktestcocos/proj.android/../cocos2d/external/Box2D/.. -IC:/Users/Developer/Desktop/ndktestcocos/proj.android/../cocos2d/external/bullet/.. -IC:/Users/Developer/Desktop/ndktestcocos/proj.android/../cocos2d/external/freetype2/prebuilt/android/../../include/android -IC:/Users/Developer/Desktop/ndktestcocos/proj.android/../cocos2d/external/freetype2/prebuilt/android/../../include/android/freetype2 -IC:/Users/Developer/Desktop/ndktestcocos/proj.android/../cocos2d/external/png/prebuilt/android/../../include/android -IC:/Users/Developer/Desktop/ndktestcocos/proj.android/../cocos2d/external/jpeg/prebuilt/android/../../include/android -IC:/Users/Developer/Desktop/ndktestcocos/proj.android/../cocos2d/external/tiff/prebuilt/android/../../include/android -IC:/Users/Developer/Desktop/ndktestcocos/proj.android/../cocos2d/external/webp/prebuilt/android/../../include/android -IC:/Users/Developer/Desktop/ndktestcocos/proj.android/../cocos2d/external/chipmunk/prebuilt/android/../../include -IC:/Users/Developer/Desktop/ndktestcocos/proj.android/../cocos2d/external/zlib/prebuilt/android/../../include -IC:/Users/Developer/Desktop/ndktestcocos/proj.android/../cocos2d/external/recast/.. -IC:/Users/Developer/Desktop/ndktestcocos/proj.android/../cocos2d/cocos/platform/android -IC:/Developer/android-ndk-r11c/build//../sources/android/cpufeatures -Ijni -DANDROID -DUSE_FILE32API -Wa,--noexecstack -Wformat -Werror=format-security -Wno-deprecated-declarations -Wno-extern-c-compat -D__STDC_LIMIT_MACROS=1 -Wno-extern-c-compat -fexceptions -frtti -DCC_ENABLE_CHIPMUNK_INTEGRATION=1 -std=c++11 -fsigned-char -DCOCOS2D_DEBUG=1 -isystem C:/Developer/android-ndk-r11c/build//../platforms/android-15/arch-arm/usr/include -c jni/../../Classes/AppDelegate.cpp -o ./obj/local/armeabi/objs-debug/cocos2dcpp_shared/__/__/Classes/AppDelegate.o, ...) failed.
make (e=2): The system cannot find the file specified.
make: *** [obj/local/armeabi/objs-debug/cocos2dcpp_shared/__/__/Classes/AppDelegate.o] Error 2
make: *** Waiting for unfinished jobs....
process_begin: CreateProcess(NULL, C:/Developer/android-ndk-r11c/build//../toolchains/arm-linux-androideabi-4.8/prebuilt/windows-x86_64/bin/arm-linux-androideabi-g++ -MMD -MP -MF ./obj/local/armeabi/objs-debug/cocos2dcpp_shared/hellocpp/main.o.d -fno-exceptions -fno-rtti -Ijni/../../Classes -IC:/Developer/android-ndk-r11c/build//../sources/cxx-stl/gnu-libstdc++/4.9/include -IC:/Developer/android-ndk-r11c/build//../sources/cxx-stl/gnu-libstdc++/4.9/libs/armeabi/include -IC:/Developer/android-ndk-r11c/build//../sources/cxx-stl/gnu-libstdc++/4.9/include/backward -IC:/Users/Developer/Desktop/ndktestcocos/proj.android/../cocos2d/cocos/editor-support/cocostudio/.. -IC:/Users/Developer/Desktop/ndktestcocos/proj.android/../cocos2d/cocos/editor-support/cocosbuilder/.. -IC:/Users/Developer/Desktop/ndktestcocos/proj.android/../cocos2d/cocos/3d/.. -IC:/Users/Developer/Desktop/ndktestcocos/proj.android/../cocos2d/cocos/editor-support/spine/.. -IC:/Users/Developer/Desktop/ndktestcocos/proj.android/../cocos2d/cocos/network -IC:/Users/Developer/Desktop/ndktestcocos/proj.android/../cocos2d/cocos/audio/android/../include -IC:/Users/Developer/Desktop/ndktestcocos/proj.android/../cocos2d/cocos/ui/../editor-support -IC:/Users/Developer/Desktop/ndktestcocos/proj.android/../cocos2d/cocos/audio/android/../include -IC:/Users/Developer/Desktop/ndktestcocos/proj.android/../cocos2d/external/flatbuffers/.. -IC:/Users/Developer/Desktop/ndktestcocos/proj.android/../cocos2d/extensions/. -IC:/Users/Developer/Desktop/ndktestcocos/proj.android/../cocos2d/extensions/.. -IC:/Users/Developer/Desktop/ndktestcocos/proj.android/../cocos2d/extensions/GUI/CCControlExtension -IC:/Users/Developer/Desktop/ndktestcocos/proj.android/../cocos2d/extensions/GUI/CCScrollView -IC:/Users/Developer/Desktop/ndktestcocos/proj.android/../cocos2d/cocos/. -IC:/Users/Developer/Desktop/ndktestcocos/proj.android/../cocos2d/cocos/./. -IC:/Users/Developer/Desktop/ndktestcocos/proj.android/../cocos2d/cocos/./.. -IC:/Users/Developer/Desktop/ndktestcocos/proj.android/../cocos2d/cocos/./platform -IC:/Users/Developer/Desktop/ndktestcocos/proj.android/../cocos2d/cocos/./base -IC:/Users/Developer/Desktop/ndktestcocos/proj.android/../cocos2d/cocos/./../external -IC:/Users/Developer/Desktop/ndktestcocos/proj.android/../cocos2d/cocos/./../external/tinyxml2 -IC:/Users/Developer/Desktop/ndktestcocos/proj.android/../cocos2d/cocos/./../external/unzip -IC:/Users/Developer/Desktop/ndktestcocos/proj.android/../cocos2d/cocos/./../external/chipmunk/include/chipmunk -IC:/Users/Developer/Desktop/ndktestcocos/proj.android/../cocos2d/cocos/./../external/xxhash -IC:/Users/Developer/Desktop/ndktestcocos/proj.android/../cocos2d/cocos/./../external/nslog -IC:/Users/Developer/Desktop/ndktestcocos/proj.android/../cocos2d/cocos/./../external/poly2tri -IC:/Users/Developer/Desktop/ndktestcocos/proj.android/../cocos2d/cocos/./../external/poly2tri/common -IC:/Users/Developer/Desktop/ndktestcocos/proj.android/../cocos2d/cocos/./../external/poly2tri/sweep -IC:/Users/Developer/Desktop/ndktestcocos/proj.android/../cocos2d/cocos/./../external/clipper -IC:/Users/Developer/Desktop/ndktestcocos/proj.android/../cocos2d/external/websockets/prebuilt/android/../../include/android -IC:/Users/Developer/Desktop/ndktestcocos/proj.android/../cocos2d/external/Box2D/.. -IC:/Users/Developer/Desktop/ndktestcocos/proj.android/../cocos2d/external/bullet/.. -IC:/Users/Developer/Desktop/ndktestcocos/proj.android/../cocos2d/external/freetype2/prebuilt/android/../../include/android -IC:/Users/Developer/Desktop/ndktestcocos/proj.android/../cocos2d/external/freetype2/prebuilt/android/../../include/android/freetype2 -IC:/Users/Developer/Desktop/ndktestcocos/proj.android/../cocos2d/external/png/prebuilt/android/../../include/android -IC:/Users/Developer/Desktop/ndktestcocos/proj.android/../cocos2d/external/jpeg/prebuilt/android/../../include/android -IC:/Users/Developer/Desktop/ndktestcocos/proj.android/../cocos2d/external/tiff/prebuilt/android/../../include/android -IC:/Users/Developer/Desktop/ndktestcocos/proj.android/../cocos2d/external/webp/prebuilt/android/../../include/android -IC:/Users/Developer/Desktop/ndktestcocos/proj.android/../cocos2d/external/chipmunk/prebuilt/android/../../include -IC:/Users/Developer/Desktop/ndktestcocos/proj.android/../cocos2d/external/zlib/prebuilt/android/../../include -IC:/Users/Developer/Desktop/ndktestcocos/proj.android/../cocos2d/external/recast/.. -IC:/Users/Developer/Desktop/ndktestcocos/proj.android/../cocos2d/cocos/platform/android -IC:/Developer/android-ndk-r11c/build//../sources/android/cpufeatures -Ijni -DANDROID -DUSE_FILE32API -Wa,--noexecstack -Wformat -Werror=format-security -Wno-deprecated-declarations -Wno-extern-c-compat -D__STDC_LIMIT_MACROS=1 -Wno-extern-c-compat -fexceptions -frtti -DCC_ENABLE_CHIPMUNK_INTEGRATION=1 -std=c++11 -fsigned-char -DCOCOS2D_DEBUG=1 -isystem C:/Developer/android-ndk-r11c/build//../platforms/android-15/arch-arm/usr/include -c jni/hellocpp/main.cpp -o ./obj/local/armeabi/objs-debug/cocos2dcpp_shared/hellocpp/main.o, ...) failed.
make (e=2): The system cannot find the file specified.
make: *** [obj/local/armeabi/objs-debug/cocos2dcpp_shared/hellocpp/main.o] Error 2
make: Leaving directory `C:/Users/Developer/Desktop/ndktestcocos/proj.android'
Error running command, return code: 2.
C:\Users\Developer\Desktop\ndktestcocos>

Posts: 5

Participants: 3

Read full topic

Label overflow not clamping text

@rob_type25 wrote:

Hi there

Using Cocos2dx-3.10

Hopefully a trivial one but can't work it out...

How do i constrain a labels text to it's contentSize?

Example:

auto usernameLabel = Label::createWithTTF(item->username, "fonts/WhitneyMedium.ttf", 8.0);
    usernameLabel->setPosition(Vec2(0, cell->getContentSize().height/2));
    usernameLabel->setContentSize(Size(20, usernameLabel->getContentSize().height));
    usernameLabel->setOverflow(cocos2d::Label::Overflow::CLAMP);

This doesn't "clamp" the text. Ideally i'd like ellipsis but i'll settle for it just clipping the text at the moment.

Thanks!

Posts: 3

Participants: 2

Read full topic

Building on Ubuntu 16.04 issues

@eht wrote:

The first issue (SOLVED):

/opt/cocos2d-x/cocos/2d/CCActionCamera.cpp:197:22: error: ‘isnan’ was not declared in this scope
     if( isnan(_angleX) )
                      ^
/opt/cocos2d-x/cocos/2d/CCActionCamera.cpp:197:22: note: suggested alternative:
In file included from /usr/include/c++/5.3.0/random:38:0,
                 from /opt/cocos2d-x/cocos/base/ccRandom.h:29,
                 from /opt/cocos2d-x/cocos/base/ccMacros.h:73,
                 from /opt/cocos2d-x/cocos/math/CCGeometry.h:32,
                 from /opt/cocos2d-x/cocos/2d/CCAction.h:32,
                 from /opt/cocos2d-x/cocos/2d/CCActionInterval.h:33,
                 from /opt/cocos2d-x/cocos/2d/CCActionCamera.h:31,
                 from /opt/cocos2d-x/cocos/2d/CCActionCamera.cpp:28:
/usr/include/c++/5.3.0/cmath:641:5: note:   ‘std::isnan’
     isnan(_Tp __x)
cocos/CMakeFiles/cocos2d.dir/build.make:86: recipe for target 'cocos/CMakeFiles/cocos2d.dir/2d/CCActionCamera.cpp.o' failed
make[2]: *** [cocos/CMakeFiles/cocos2d.dir/2d/CCActionCamera.cpp.o] Error 1
CMakeFiles/Makefile2:419: recipe for target 'cocos/CMakeFiles/cocos2d.dir/all' failed
make[1]: *** [cocos/CMakeFiles/cocos2d.dir/all] Error 2
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2

This is resolved by simply running:

sed -i 's/isnan/std::isnan/g' `grep "isnan" -rl`

The second issue (UNRESOLVED):

[ 17%] Building C object cocos/scripting/lua-bindings/CMakeFiles/luacocos2d.dir/__/__/__/external/lua/lua/ltable.c.o
In file included from /home/eht/tools/cocos2d-x-3.10/external/lua/lua/lua.h:16:0,
                 from /home/eht/tools/cocos2d-x-3.10/external/lua/lua/ltable.c:27:
/home/eht/tools/cocos2d-x-3.10/external/lua/lua/luaconf.h:543:20: warning: ISO C99 requires whitespace after the macro name
 #define luai_numstd::isnan(a) (!luai_numeq((a), (a)))
                    ^
/home/eht/tools/cocos2d-x-3.10/external/lua/lua/ltable.c: In function ‘luaH_set’:
/home/eht/tools/cocos2d-x-3.10/external/lua/lua/luaconf.h:543:20: error: expected expression before ‘:’ token
 #define luai_numstd::isnan(a) (!luai_numeq((a), (a)))
                    ^
/home/eht/tools/cocos2d-x-3.10/external/lua/lua/ltable.c:501:33: note: in expansion of macro ‘luai_numstd’
     else if (ttisnumber(key) && luai_numstd::isnan(nvalue(key)))
                                 ^
cocos/scripting/lua-bindings/CMakeFiles/luacocos2d.dir/build.make:302: recipe for target 'cocos/scripting/lua-bindings/CMakeFiles/luacocos2d.dir/__/__/__/external/lua/lua/ltable.c.o' failed
make[2]: *** [cocos/scripting/lua-bindings/CMakeFiles/luacocos2d.dir/__/__/__/external/lua/lua/ltable.c.o] Error 1
CMakeFiles/Makefile2:672: recipe for target 'cocos/scripting/lua-bindings/CMakeFiles/luacocos2d.dir/all' failed
make[1]: *** [cocos/scripting/lua-bindings/CMakeFiles/luacocos2d.dir/all] Error 2
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2

Any help appreciated.

Posts: 5

Participants: 2

Read full topic

SDKBOXPLAY Android error v2.2.0.15

@energyy wrote:

Hello,
@nite

SDKBOXPLAY plugin seems not yet fixed, we againt trying to integrate it, imported/initialized for now app not crashing.

Set in json connect_on_start: true and app crashed:

99/? I/SDKBOX_CORE: Initialization request for plugin: 'com/sdkbox/plugin/PluginSdkboxPlay'
05-03 15:54:27.857 1560-1599/? W/PopupManager: You have not specified a View to use as content view for popups. Falling back to the Activity content view. Note that this may not work as expected in multi-screen environments
05-03 15:54:27.857 1560-1599/? E/sdkboxplay: init native fail
05-03 15:54:27.858 1560-1599/? A/art: art/runtime/thread.cc:1147] No pending exception expected: java.lang.IncompatibleClassChangeError: The method 'boolean com.google.android.gms.common.api.GoogleApiClient.isConnected()' was expected to be of type virtual but instead was found to be of type interface (declaration of 'java.lang.reflect.ArtMethod' appears in /system/framework/core-libart.jar)
05-03 15:54:27.858 1560-1599/? A/art: art/runtime/thread.cc:1147]   at void com.sdkbox.plugin.PluginSdkboxPlay.connect() (PluginSdkboxPlay.java:245)
05-03 15:54:27.858 1560-1599/? A/art: art/runtime/thread.cc:1147]   at boolean com.sdkbox.plugin.PluginSdkboxPlay.nativeInit(com.sdkbox.plugin.JSON) (PluginSdkboxPlay.java:238)
05-03 15:54:27.858 1560-1599/? A/art: art/runtime/thread.cc:1147]   at void org.cocos2dx.lib.Cocos2dxRenderer.nativeInit(int, int) (Cocos2dxRenderer.java:-2)
05-03 15:54:27.858 1560-1599/? A/art: art/runtime/thread.cc:1147]   at void org.cocos2dx.lib.Cocos2dxRenderer.onSurfaceCreated(javax.microedition.khronos.opengles.GL10, javax.microedition.khronos.egl.EGLConfig) (Cocos2dxRenderer.java:72)
05-03 15:54:27.858 1560-1599/? A/art: art/runtime/thread.cc:1147]   at void android.opengl.GLSurfaceView$GLThread.guardedRun() (GLSurfaceView.java:1500)
05-03 15:54:27.858 1560-1599/? A/art: art/runtime/thread.cc:1147]   at void android.opengl.GLSurfaceView$GLThread.run() (GLSurfaceView.java:1239)
05-03 15:54:27.858 1560-1599/? A/art: art/runtime/thread.cc:1147] 
05-03 15:54:27.888 1560-1599/? A/art: art/runtime/runtime.cc:295] Runtime aborting...
05-03 15:54:27.888 1560-1599/? A/art: art/runtime/runtime.cc:295] Aborting thread:
05-03 15:54:27.888 1560-1599/? A/art: art/runtime/runtime.cc:295] "GLThread 8362" prio=5 tid=15 Runnable
05-03 15:54:27.888 1560-1599/? A/art: art/runtime/runtime.cc:295]   | group="" sCount=0 dsCount=0 obj=0x12c22590 self=0xb4836000
05-03 15:54:27.888 1560-1599/? A/art: art/runtime/runtime.cc:295]   | sysTid=1599 nice=0 cgrp=default sched=0/0 handle=0xb362a000
05-03 15:54:27.888 1560-1599/? A/art: art/runtime/runtime.cc:295]   | state=R schedstat=( 510503398 197548003 1536 ) utm=45 stm=6 core=0 HZ=100
05-03 15:54:27.888 1560-1599/? A/art: art/runtime/runtime.cc:295]   | stack=0xaf198000-0xaf19a000 stackSize=1036KB
05-03 15:54:27.888 1560-1599/? A/art: art/runtime/runtime.cc:295]   | held mutexes= "abort lock" "mutator lock"(shared held)
05-03 15:54:27.888 1560-1599/? A/art: art/runtime/runtime.cc:295]   native: #00 pc 0000484c  /system/lib/libbacktrace_libc++.so (UnwindCurrent::Unwind(unsigned int, ucontext*)+23)
05-03 15:54:27.888 1560-1599/? A/art: art/runtime/runtime.cc:295]   native: #01 pc 00003031  /system/lib/libbacktrace_libc++.so (Backtrace::Unwind(unsigned int, ucontext*)+8)
05-03 15:54:27.888 1560-1599/? A/art: art/runtime/runtime.cc:295]   native: #02 pc 00242f8b  /system/lib/libart.so (art::DumpNativeStack(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, int, char const*, art::mirror::ArtMethod*, BacktraceMap*)+70)
05-03 15:54:27.888 1560-1599/? A/art: art/runtime/runtime.cc:295]   native: #03 pc 002276af  /system/lib/libart.so (art::Thread::Dump(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, BacktraceMap*) const+154)
05-03 15:54:27.888 1560-1599/? A/art: art/runtime/runtime.cc:295]   native: #04 pc 0021765d  /system/lib/libart.so (art::AbortState::DumpThread(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, art::Thread*)+24)
05-03 15:54:27.888 1560-1599/? A/art: art/runtime/runtime.cc:295]   native: #05 pc 002178df  /system/lib/libart.so (art::AbortState::Dump(std::__1::basic_ostream<char, std::__1::char_traits<char> >&)+390)
05-03 15:54:27.888 1560-1599/? A/art: art/runtime/runtime.cc:295]   native: #06 pc 00217ae1  /system/lib/libart.so (art::Runtime::Abort()+72)
05-03 15:54:27.888 1560-1599/? A/art: art/runtime/runtime.cc:295]   native: #07 pc 000a654b  /system/lib/libart.so (art::LogMessage::~LogMessage()+1322)
05-03 15:54:27.888 1560-1599/? A/art: art/runtime/runtime.cc:295]   native: #08 pc 002255c9  /system/lib/libart.so (art::Thread::AssertNoPendingException() const+376)
05-03 15:54:27.888 1560-1599/? A/art: art/runtime/runtime.cc:295]   native: #09 pc 000d6dd3  /system/lib/libart.so (art::ClassLinker::FindClass(art::Thread*, char const*, art::Handle<art::mirror::ClassLoader>)+14)
05-03 15:54:27.888 1560-1599/? A/art: art/runtime/runtime.cc:295]   native: #10 pc 001cd1ed  /system/lib/libart.so (art::JNI::FindClass(_JNIEnv*, char const*)+796)
05-03 15:54:27.888 1560-1599/? A/art: art/runtime/runtime.cc:295]   native: #11 pc 001fbd83  /data/app/com.funlab.loop-1/lib/arm/libcocos2dcpp.so (_JNIEnv::FindClass(char const*)+6)
05-03 15:54:27.888 1560-1599/? A/art: art/runtime/runtime.cc:295]   native: #12 pc 001fc0c5  /data/app/com.funlab.loop-1/lib/arm/libcocos2dcpp.so (sdkbox::JNIUtils::GetClassObjectFromName(char const*, _JNIEnv*)+20)
05-03 15:54:27.888 1560-1599/? A/art: art/runtime/runtime.cc:295]   native: #13 pc 001fc79f  /data/app/com.funlab.loop-1/lib/arm/libcocos2dcpp.so (sdkbox::JNIUtils::GetJNIStaticMethodInfo(char const*, char const*, char const*, _JNIEnv*)+26)
05-03 15:54:27.888 1560-1599/? A/art: art/runtime/runtime.cc:295]   native: #14 pc 001fb1f3  /data/app/com.funlab.loop-1/lib/arm/libcocos2dcpp.so (_ZN6sdkbox15JNIInvokeStaticISsIEEET_PKcS3_DpT0_+30)
05-03 15:54:27.888 1560-1599/? A/art: art/runtime/runtime.cc:295]   native: #15 pc 001fb359  /data/app/com.funlab.loop-1/lib/arm/libcocos2dcpp.so (sdkbox::SdkboxCore::getChannel() const+12)
05-03 15:54:27.888 1560-1599/? A/art: art/runtime/runtime.cc:295]   native: #16 pc 001f58a7  /data/app/com.funlab.loop-1/lib/arm/libcocos2dcpp.so (sdkbox::ConfigManager::getConfig(char const*) const+118)
05-03 15:54:27.888 1560-1599/? A/art: art/runtime/runtime.cc:295]   native: #17 pc 001f59a9  /data/app/com.funlab.loop-1/lib/arm/libcocos2dcpp.so (sdkbox::ConfigManager::isEnabled(std::string const&) const+16)
05-03 15:54:27.888 1560-1599/? A/art: art/runtime/runtime.cc:295]   native: #18 pc 001f2709  /data/app/com.funlab.loop-1/lib/arm/libcocos2dcpp.so (sdkbox::FacebookWrapper::getInstance()+36)
05-03 15:54:27.888 1560-1599/? A/art: art/runtime/runtime.cc:295]   native: #19 pc 001f2a97  /data/app/com.funlab.loop-1/lib/arm/libcocos2dcpp.so (sdkbox::PluginFacebook::init()+2)
05-03 15:54:27.888 1560-1599/? A/art: art/runtime/runtime.cc:295]   native: #20 pc 0018e4e1  /data/app/com.funlab.loop-1/lib/arm/libcocos2dcpp.so (AppDelegate::applicationDidFinishLaunching()+1320)
05-03 15:54:27.888 1560-1599/? A/art: art/runtime/runtime.cc:295]   native: #21 pc 001fd815  /data/app/com.funlab.loop-1/lib/arm/libcocos2dcpp.so (cocos2d::Application::run()+6)
05-03 15:54:27.888 1560-1599/? A/art: art/runtime/runtime.cc:295]   native: #22 pc 001fe891  /data/app/com.funlab.loop-1/lib/arm/libcocos2dcpp.so (Java_org_cocos2dx_lib_Cocos2dxRenderer_nativeInit+104)
05-03 15:54:27.888 1560-1599/? A/art: art/runtime/runtime.cc:295]   native: #23 pc 0023a86d  /data/dalvik-cache/arm/data@app@com.funlab.loop-1@base.apk@classes.dex (Java_org_cocos2dx_lib_Cocos2dxRenderer_nativeInit__II+88)
05-03 15:54:27.888 1560-1599/? A/art: art/runtime/runtime.cc:295]   at org.cocos2dx.lib.Cocos2dxRenderer.nativeInit(Native method)
05-03 15:54:27.888 1560-1599/? A/art: art/runtime/runtime.cc:295]   at org.cocos2dx.lib.Cocos2dxRenderer.onSurfaceCreated(Cocos2dxRenderer.java:72)
05-03 15:54:27.888 1560-1599/? A/art: art/runtime/runtime.cc:295]   at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1500)
05-03 15:54:27.888 1560-1599/? A/art: art/runtime/runtime.cc:295]   at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1239)
05-03 15:54:27.888 1560-1599/? A/art: art/runtime/runtime.cc:295] Pending exception java.lang.IncompatibleClassChangeError thrown by 'unknown throw location'
05-03 15:54:27.888 1560-1599/? A/art: art/runtime/runtime.cc:295] java.lang.IncompatibleClassChangeError: The method 'boolean com.google.android.gms.common.api.GoogleApiClient.isConnected()' was expected to be of type virtual but instead was found to be of type interface (declaration of 'java.lang.reflect.ArtMethod' appears in /system/framework/core-libart.jar)
05-03 15:54:27.888 1560-1599/? A/art: art/runtime/runtime.cc:295]   at void com.sdkbox.plugin.PluginSdkboxPlay.connect() (PluginSdkboxPlay.java:245)
05-03 15:54:27.888 1560-1599/? A/art: art/runtime/runtime.cc:295]   at boolean com.sdkbox.plugin.PluginSdkboxPlay.nativeInit(com.sdkbox.plugin.JSON) (PluginSdkboxPlay.java:238)
05-03 15:54:27.888 1560-1599/? A/art: art/runtime/runtime.cc:295]   at void org.cocos2dx.lib.Cocos2dxRenderer.nativeInit(int, int) (Cocos2dxRenderer.java:-2)
05-03 15:54:27.888 1560-1599/? A/art: art/runtime/runtime.cc:295]   at void org.cocos2dx.lib.Cocos2dxRenderer.onSurfaceCreated(javax.microedition.khronos.opengles.GL10, javax.microedition.khronos.egl.EGLConfig) (Cocos2dxRenderer.java:72)
05-03 15:54:27.888 1560-1599/? A/art: art/runtime/runtime.cc:295]   at void android.opengl.GLSurfaceView$GLThread.guardedRun() (GLSurfaceView.java:1500)
05-03 15:54:27.888 1560-1599/? A/art: art/runtime/runtime.cc:295]   at void android.opengl.GLSurfaceView$GLThread.run() (GLSurfaceView.java:1239)
05-03 15:54:27.888 1560-1599/? A/art: art/runtime/runtime.cc:295] Dumping all threads without appropriate locks held: thread list lock
05-03 15:54:27.888 1560-1599/? A/art: art/runtime/runtime.cc:295] 
05-03 15:54:28.293 1560-1602/? E/CrashlyticsNdk: Failed to parse NDK crash data.
05-03 15:54:28.293 1560-1602/? E/CrashlyticsNdk: org.json.JSONException: End of input at character 0 of 
05-03 15:54:28.293 1560-1602/? E/CrashlyticsNdk:     at org.json.JSONTokener.syntaxError(JSONTokener.java:450)
05-03 15:54:28.293 1560-1602/? E/CrashlyticsNdk:     at org.json.JSONTokener.nextValue(JSONTokener.java:97)
05-03 15:54:28.293 1560-1602/? E/CrashlyticsNdk:     at org.json.JSONObject.<init>(JSONObject.java:156)
05-03 15:54:28.293 1560-1602/? E/CrashlyticsNdk:     at org.json.JSONObject.<init>(JSONObject.java:173)
05-03 15:54:28.293 1560-1602/? E/CrashlyticsNdk:     at com.crashlytics.android.ndk.JsonCrashDataParser.parseCrashEventData(JsonCrashDataParser.java:73)
05-03 15:54:28.293 1560-1602/? E/CrashlyticsNdk:     at com.crashlytics.android.ndk.CrashlyticsNdk.doInBackground(CrashlyticsNdk.java:117)
05-03 15:54:28.293 1560-1602/? E/CrashlyticsNdk:     at com.crashlytics.android.ndk.CrashlyticsNdk.doInBackground(CrashlyticsNdk.java:23)
05-03 15:54:28.293 1560-1602/? E/CrashlyticsNdk:     at io.fabric.sdk.android.InitializationTask.doInBackground(InitializationTask.java:63)
05-03 15:54:28.293 1560-1602/? E/CrashlyticsNdk:     at io.fabric.sdk.android.InitializationTask.doInBackground(InitializationTask.java:28)
05-03 15:54:28.293 1560-1602/? E/CrashlyticsNdk:     at io.fabric.sdk.android.services.concurrency.AsyncTask$2.call(AsyncTask.java:311)
05-03 15:54:28.293 1560-1602/? E/CrashlyticsNdk:     at java.util.concurrent.FutureTask.run(FutureTask.java:237)
05-03 15:54:28.293 1560-1602/? E/CrashlyticsNdk:     at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:422)
05-03 15:54:28.293 1560-1602/? E/CrashlyticsNdk:     at java.util.concurrent.FutureTask.run(FutureTask.java:237)
05-03 15:54:28.293 1560-1602/? E/CrashlyticsNdk:     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
05-03 15:54:28.293 1560-1602/? E/CrashlyticsNdk:     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
05-03 15:54:28.293 1560-1602/? E/CrashlyticsNdk:     at java.lang.Thread.run(Thread.java:818)
05-03 15:54:29.951 339-950/? D/audio_hw_primary: out_standby: enter: stream (0xb54a53c0) usecase(1: low-latency-playback)
05-03 15:54:29.951 339-950/? D/hardware_info: hw_info_append_hw_type : device_name = speaker
05-03 15:54:30.073 339-950/? W/audio_hw_primary: disable_snd_device: device ref cnt is already 0

Posts: 3

Participants: 1

Read full topic

Including fmod in cocos2d-x 3.8 for iOS and Android

@Rambazamba wrote:

Hi there, i want to try fmod now for iOS and Android. ATM I use version 3.8. My plan would be to copy the programmers apis for android and ios into the external folder and write some kind of wrapper class to controll fmod.
But how do I include the fmod.jar or .a files for example? Fmod provides a demo example for windows (https://github.com/fmod/EarthWarrior3D) that does not help too much. Other tutorials I found were too old to be used. Is there some tutorial how to add external libraries to cocos2d-x?

Best regards
Rambazamba

Posts: 1

Participants: 1

Read full topic

Creating Glowing Circle

Developing with cocos on a school computer

@cubby208 wrote:

OK, So I have been trying to get into cocos 2d. I am having a fit of a time getting it set up because of all the console stuff, and where to put files... and I think I previously messed some of this stuff up when setting up opengl.

Anyway. I am going to try to start again!! My problem is I would love to get it set up on a school computer... the downside being that this computer asks for administrator privileges every stinking time!!!!

My teacher is fond of me and trusts me, so he will probably sign off on them, however I dont want to bombard him or annoy him.

I am avoiding using a cocos2d editor because I really dont like editors, I prefer to place and create all of my objects inside of code. Also I am fluent in C++ and Java.

Also I am technically developing an android app, however if thats two complex mabye I can port it.

So I have some questions.

  1. What would be the way to get cocos going on a school computer (Minimal ammount of admin privelages... doubtful that I can use command prompt without it storming the building declaring I am "Hacking the system")
  2. If I developed it for pc, would it be easy to port it over to android? Perhaps if its too hard to set up the android side on a school computer I could just do the android stuff later? I do all of my placements and sizes as a function of screen size, so that wont be an issue.
  3. Is it harder to get cocos2d for android targets going, or cocos2d for pc going?

Thanks so much! Hope to be joining your community soon!

Posts: 2

Participants: 2

Read full topic


ListView not aligning magnetically like expected with scrolltoitem

@rob_type25 wrote:

Hi there

Been battling with a ListView for a while and while i sort of have it working when i now try to use the scrolltoitem method it's not aligning centrally in the listview as i expect.

I have a pretty simple setup, it's a portrait game and i have a listview that spans the top half of the screen with basically one large circle visible at one particular time, as below:

Image may be NSFW.
Clik here to view.

I'm using gravity center and magnetictype center_horizontal and the user can flick through the circles and they all align in the center, perfect!

The code i'm using for creating the listview is as follows:

  listView = cocos2d::ui::ListView::create();
    listView->setDirection(ui::ScrollView::Direction::HORIZONTAL);
    listView->setTouchEnabled(true);
    listView->setBounceEnabled(true);
    listView->setScrollBarEnabled(false);
    listView->setContentSize(Size(visibleSize.width, 130));
    listView->setAnchorPoint(Vec2(0.5,1));
    listView->setPosition(Vec2(origin.x + visibleSize.width/2, visibleSize.height + origin.y - 25));
    listView->setClippingEnabled(false);
    listView->setMagneticAllowedOutOfBoundary(false);
    listView->setSwallowTouches(false);
    listView->setInertiaScrollEnabled(false);
    listView->setItemsMargin(10.0f);
    listView->setMagneticType(cocos2d::ui::ListView::MagneticType::CENTER);
    listView->setGravity(cocos2d::ui::ListView::Gravity::CENTER_HORIZONTAL);
    addChild(listView);

I then populate some widgets like this:

for (int i =0;i<arr.size();i++){

        btn->setTouchEnabled(true);
        btn->ignoreContentAdaptWithSize(false);
        btn->setContentSize(Size(130, 130));
        btn->setAnchorPoint(Vec2(0, 0));
        btn->setTag(qCurrent->id);
        btn->setName("button");

        btn->addChild(actionLabel);
        auto wid1 = Widget::create();
        wid1->setContentSize(btn->getContentSize());
        wid1->addChild(btn);

        listView->pushBackCustomItem(wid1);
    }

So far so good, everything snaps to the center of the screen.

My issue is now when i use this:

listView->scrollToItem(5, Vec2(0,0), Vec2(0,0));

It scrolls to the item OK but it's off center, see below

Image may be NSFW.
Clik here to view.

I'm not entirely sure if i'm adding my items correctly or my listview is configured right for this setup?

Any guidance greatly appreciated.

Posts: 2

Participants: 1

Read full topic

Splash Screen for slow loading Android App

@nov wrote:

I try to add Splash Screen to my Cocos2dx Android app, which I ported from iOS.

Because:
1. It takes so much time, before the App starts (around 17 seconds).
2. It shows black screen during waiting.

I tried to add Splash Sreen Java way, but it displays image for a few seconds only and then switches back again to black screen for the rest of start up time.

I have this code there.

styles.xml

<resources>

<!-- Base application theme. -->
<!-- <style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar"> -->
<!-- Customize your theme here. -->
<!-- </style> -->

    <style name="SplashTheme" parent="android:style/Theme"> <!-- Theme.AppCompat.NoActionBar @android:style/Theme.NoTitleBar.Fullscreen -->
        <item name="android:windowBackground">@drawable/background_splash</item>
        <item name="android:windowNoTitle">true</item>
        <item name="android:windowFullscreen">true</item>
        <item name="android:windowContentOverlay">@null</item>
    </style>

</resources>

SplashActivity.Java

package com.bignerdranch.android.splash;

import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;

public class SplashActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        Intent intent = new Intent(this, MainActivity.class);
        startActivity(intent);
        finish();
    }
}

drawable/background_splash.xml

<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">

    <item
        android:drawable="@color/gray"/>

    <item>
        <bitmap
            android:gravity="center"
            android:src="@mipmap/ic_launcher"/>
    </item>

</layer-list>

AndroidManifest.xml

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.de.test"
    android:installLocation="auto">

    <uses-feature android:glEsVersion="0x00020000" />
    <uses-sdk
        android:minSdkVersion="11"
        android:targetSdkVersion="19" />

    <application
        android:allowBackup="true"
        android:label="@string/app_name"
        android:icon="@drawable/icon">

        <!-- Tell Cocos2dxActivity the name of our .so -->
		<meta-data android:name="android.app.lib_name"
				   android:value="cocos2dcpp" />

        <!-- android:theme="@android:style/Theme.NoTitleBar.Fullscreen"  portrait -->
        <activity
            android:name="org.cocos2dx.cpp.AppActivity"
            android:launchMode="singleTop"
            android:screenOrientation="sensorPortrait"
            android:configChanges="orientation|keyboardHidden|screenSize"
            android:label="@string/app_name"
            android:theme="@style/SplashTheme">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>

    <uses-permission android:name="android.permission.INTERNET"/>
    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>

</manifest>
  1. How to improve it, to show Splash Screen during whole Cocos2dx App loading (instead of black screen)?

  2. How to improve start up time?

Posts: 1

Participants: 1

Read full topic

Do not understand box2d Step() and update interval when using cocos2d-x?

@nichlaspro132 wrote:

Hi!

When you simulate the physics in box2d, you are using Step().

But in the user manual it is used in a for loop like this and not as something that will be running all the time:

float32 timeStep = 1.0f / 60.0f;
int32 velocityIterations = 6;
int32 positionIterations = 2;
///////////////////////////////////////
for (int32 i = 0; i < 60; ++i)
{
world.Step(timeStep, velocityIterations, positionIterations);
b2Vec2 position = body->GetPosition();
float32 angle = body->GetAngle();
printf("%4.2f %4.2f %4.2f\n", position.x, position.y, angle);
}
Here, the float32 timeStep is always the same.

But when you are doing it in a scheduled updater function i see some do it like this:

void Level::update(float dt)
{
  // get current time double
  currentTime = getCurrentTimeInSeconds();
  if (!lastTickTime)
    lastTickTime = currentTime;
  // determine the amount of time elapsed since our last update
  double frameTime = currentTime - lastTickTime;
  accumulator += frameTime;
  // update the world with the same seconds per update
  while (accumulator > kSecondsPerUpdate)
  {
    accumulator -= kSecondsPerUpdate;
    // perform a single step of the physics simulation
    world->Step(kSecondsPerUpdate, 8, 1);
  }
  lastTickTime = currentTime;
}

And this

void HelloWorld::update(float dt){
   int positionIterations = 10;  
   int velocityIterations = 10;
   deltaTime = dt;
   world->Step(dt, velocityIterations, positionIterations);  
    world->ClearForces();
    world->DrawDebugData();        
}

In both examples they are running the Step function with an interval that is updating/changing all the time and isn't dt getting bigger and bigger all the time or at least changing.

So my question is - Why are they not using a constant value in the last two examples when the one from the user manual is and why? When do i have to do what??

Really hope you get me. Image may be NSFW.
Clik here to view.
smile

Thank you!

Posts: 5

Participants: 4

Read full topic

TCP Socket Library

@devilzk wrote:

Hi,

Is there any tcp socket library which allow cocos2d-x game to connect to a socket server and enable send/receive of strings.

I am not looking for Websockets / Socket.IO or any other service based platforms. My primary targets for game are android and iOS and porting an existing flash game to cocos2d-x. So want to use same tcp socket server.

Any example would be great.

Thanks

Posts: 1

Participants: 1

Read full topic

App store uploading(64-bit not supporting) issue with Cocos2dxv3.0-pre-alpha0

@ritusin wrote:

Hi All,

I have developed a game with Cocos2dxv3.0-pre-alpha0 and while uploading the game on app store,i have stuck with an issue that the project is missing 64-bit support as below:-

Image may be NSFW.
Clik here to view.

then i have changed the architecture from 32-bit to 64-bit but then i got a lot of errors(201) related to cocos2dx referencing as below:-

I have searched for this issue,then i got the solution that libcocos2dx is not running for 64-bit then i have changed the architecture for libcocos2dx as below:-

Image may be NSFW.
Clik here to view.

then after running,i got issues related to libcurl:-

for this,i have searching for more than 5 days and got a link as below

In this link,one link is mentioned for updated libcurl but that is not working now.
Can anyone suggest where i can find the updated libcurl or any other solution for uploading the game with this cocos2dx version(Cocos2dxv3.0-pre-alpha0) only.

Thanks.
Any suggestion would be much appreciated.

Posts: 1

Participants: 1

Read full topic

Error retrieving parent for item

@Farrel7786729 wrote:

I get multiple "Error retrieving parent for item" errors while trying to compile my app. There is one theme about this error already -- link. Proposed solution does not seem to work. Changing API version to 21 results in crash during application startup. Here's stackoverflow thread on this type of crash -- link -- which advises to build app using 19th API, and using 19th API returns me to the first errror.

I know that Cocos2d-x 3.10 ships GPS library now which solves this error, but I need to implement some Google Cast based functionality, so I'm forced to use libs provided by sdk. And those libs cause "Error retrieving parent for item" issue.

Thanks in advance for any help.

Posts: 1

Participants: 1

Read full topic

Model 3d and image TGA problem (cocos2dx-v3.10)


Judder on first display of Sprite with SpriteFrames

@Guykun wrote:

I am currently creating an Animation with a set of SpriteFrames pre-loaded into an array from file at initialization.

During gameplay I am then creating a sprite and setting it to run the animation and this works fine, however the first time I do this, per unique set of SpriteFrames, there is a considerable judder and freeze which I am presuming is due to either lazy loading of the texture or upload to the GPU. The full set of SpriteFrames is fairly large however any subsequent creation of sprites with new animations using the set of frames there is no performance cost.

Does anyone know how I can avoid this or what I can do to force cocos2dx into loading these frames during initialization? (Or whatever else the performance cost could be).
I have tried creating a sprite and running the animation during initialization together with giving it a fake update but this has no effect, I'm guessing due to the load only happening in the visit() render loop.

The only last-resort solution I can think of is to fully add a sprite with the frames to the scene and run a loop during game load, but this is an awful lot of refactoring just to overcome this issue that I'd hope to solve in a better way.

Posts: 1

Participants: 1

Read full topic

Strange Weired Line Appear for Images

@tianxinxing wrote:

I'm using ImageView for showing images.
But sometimes strange weired line appear for some images.
Also, I'm using clipping node for masking images, but weired line appear for masking images, too.
Image may be NSFW.
Clik here to view.

I wonder why these strange weired lines appear.

How to do ?

Posts: 3

Participants: 3

Read full topic

[SOLVED]Enter level scene blink

@jecheonDaeseong wrote:

I created 3 scene level, Splash Scene -> Product Scene -> Main Menu Scene, but when entering new scene there's little annoying blink animation
Splash Scene

#include "SplashScreen.hpp"
#include "ProductScene.hpp"
#include "MainMenu.hpp"
#include "SimpleAudioEngine.h"

USING_NS_CC;
using namespace cocos2d;
using namespace CocosDenshion;
Scene* SplashScreen::createScene() {
    auto scene = Scene::create();
    
    auto layer = SplashScreen::create();
    
    scene->addChild(layer);
    
    return scene;
}

bool SplashScreen::init()
{
    
    if ( !Layer::init() )
    {
        return false;
    }
    
    Size visibleSize = Director::getInstance()->getVisibleSize();
    Vec2 origin = Director::getInstance()->getVisibleOrigin();
    
    //SimpleAudioEngine::getInstance()->playBackgroundMusic("bgMain.mp3", true);
    
    this->schedule(schedule_selector(SplashScreen::goToProductScene), 2);
    
    auto backgroundSprite = Sprite::create("raionlogo.png");
    backgroundSprite->setPosition(Vec2(visibleSize.width / 2, visibleSize.height/2));
    this->addChild(backgroundSprite);
    
    return true;
}

void SplashScreen::goToProductScene(float dt) {
    auto scene = ProductScene::createScene();
    Director::getInstance()->pushScene(TransitionFade::create(2, scene));
}

Product Scene

#include "ProductScene.hpp"
#include "MainMenu.hpp"
#include "SimpleAudioEngine.h"
#include "SplashScreen.hpp"

USING_NS_CC;
using namespace cocos2d;
using namespace CocosDenshion;

Scene* ProductScene::createScene() {
    auto scene = Scene::create();
    
    auto layer = ProductScene::create();
    
    scene->addChild(layer);
    
    return scene;
}

bool ProductScene::init()
{
    
    if ( !Layer::init() )
    {
        return false;
    }
    
    Size visibleSize = Director::getInstance()->getVisibleSize();
    Vec2 origin = Director::getInstance()->getVisibleOrigin();
    
    this->schedule(schedule_selector(ProductScene::goToMainMenuScene), 2);
    
    auto backgroundSprite = Sprite::create("product.png");
    backgroundSprite->setPosition(Vec2(visibleSize.width / 2, visibleSize.height/2));
    this->addChild(backgroundSprite);
    
    return true;
}

void ProductScene::goToMainMenuScene(float dt) {
    auto scene = MainMenu::createScene();
    Director::getInstance()->pushScene(TransitionFade::create(2, scene));
}

Main Menu Scene

#include "ProductScene.hpp"
#include "SplashScreen.hpp"
#include "MainMenu.hpp"
#include "GameLayer.h"
#include "ui/CocosGUI.h"

using namespace cocos2d;

Scene* MainMenu::createScene() {
    auto scene = Scene::create();
    
    auto layer = MainMenu::create();
    
    scene->addChild(layer);
    
    return scene;
}

bool MainMenu::init()
{
    
    if ( !Layer::init() )
    {
        return false;
    }
    
    Size visibleSize = Director::getInstance()->getVisibleSize();
    Vec2 origin = Director::getInstance()->getVisibleOrigin();
    
    auto mainMenuBg = Sprite::create("bgmainmenu.png");
    mainMenuBg->setPosition(Vec2(visibleSize.width * 0.5, visibleSize.height * 0.5));
    this->addChild(mainMenuBg);
    
    auto title = Sprite::create("logo.png");
    title->setPosition(Vec2(visibleSize.width * 0.5, visibleSize.height * 0.8));
    this->addChild(title);
    
    auto playItem = MenuItemImage::create("PLAY.png", "play clicked.png", CC_CALLBACK_1(MainMenu::goToGameScene, this));
    playItem->setPosition(Vec2(visibleSize.width * 0.5, visibleSize.height * 0.6));
    auto optionItem = MenuItemImage::create("OPTION.png", "play clicked.png", CC_CALLBACK_1(MainMenu::goToGameScene, this));
    optionItem->setPosition(Vec2(visibleSize.width * 0.5, visibleSize.height * 0.45));
    auto scoreItem = MenuItemImage::create("SCORE.png", "play clicked.png", CC_CALLBACK_1(MainMenu::goToGameScene, this));
    scoreItem->setPosition(Vec2(visibleSize.width * 0.5, visibleSize.height * 0.30));
    auto exitItem = MenuItemImage::create("EXIT.png", "play clicked.png", CC_CALLBACK_1(MainMenu::goToGameScene, this));
    exitItem->setPosition(Vec2(visibleSize.width * 0.5, visibleSize.height * 0.15));

    auto menu = Menu::create(playItem,optionItem,scoreItem,exitItem, NULL);
    menu->setPosition(Point::ZERO);
    
    this->addChild(menu);
    
    return true;
}

void MainMenu::goToGameScene(cocos2d::Ref *pSender) {
    auto scene = GameLayer::scene();
    Director::getInstance()->replaceScene(TransitionFade::create(2, scene));
}

anyone can help me ?

Posts: 3

Participants: 2

Read full topic

How to draw a triangle in 3D

@Lem wrote:

Hello!

For now I used cocos only for 2D games, now I want to do also some 3D stuff. I want to draw a triangle in 3D space, with the coordinates of lets say P1 = (0, 0, 0), P2 = (0, -100, 100), P3 = (0, 200, 100). Are there some OpenGL calls to do this kind of stuff?

And since it's my first time using 3D in cocos, are there any good 3D tutorials? Image may be NSFW.
Clik here to view.
smiley

Posts: 3

Participants: 2

Read full topic

Label is blurry

@compyler wrote:

Hello!

I am struggling with a really strange problem: I have 2 sprites where each sprite has a TTF label als child. I create both labels in the exact same way:

Label* lblMainMenu = Label::createWithTTF(ttfConfig, "Main menu");
lblMainMenu->setColor( g_menuLabelColor );
lblMainMenu->setPosition( Vec2(buttonSize.width / 2 + 0.5f, buttonSize.height / 2 + 0.5f) );
btnMainMenu->addChild(lblMainMenu);

// Second label
Label* lblSelectLevel = Label::createWithTTF(ttfConfig, "Main level");
lblSelectLevel->setColor( g_menuLabelColor );
lblSelectLevel->setPosition( Vec2(buttonSize.width / 2 + 0.5f, buttonSize.height / 2 + 0.5f) );
btnSelectLevel->addChild(lblSelectLevel);

The problem is: The first label "Main menu" is rendered with sharp edges, but the second label "Main level" is much more blurry! I made a screenshot (zoomed in) to show the effect:

Image may be NSFW.
Clik here to view.

Just look at the word "Main". The top one is much more blurry. It is especially noticable at vertical lines. The vertical lines of the "M" at the bottom are straight lines, while the verticles lines of the top "M" are blurred.

As you can see in my code I tried to play around with 0.5f offsets onto the position, because (strangely enough) this 0.5f offset makes the bottom label sharp. Even though the top label ALSO gets a 0.5f offset (the world space coordiantes of both labels has a .5 fraction; it is not a clamped integer) it is blurry!

Anyone knows this effect and has an idea how I can make my labels sharp?

Posts: 6

Participants: 4

Read full topic

Viewing all 2747 articles
Browse latest View live