Quantcast
Channel: Cocos Forums - Latest topics
Viewing all 17112 articles
Browse latest View live

AudioEngine lack of setPitch

$
0
0

@fryderyk88 wrote:

Hi there!

The new AudioEngine has suffered the lack of set pitch function since birth. At least until cocos2d-x 3.10 (which is the last version I used before upgrading to 3.13.1) it could be solved with the changes in this pull request: https://github.com/cocos2d/cocos2d-x/pull/13662

However, AudioEngine implementation has changed a lot and I cannot make it work anymore : (

I hope we will see the setPitch functionality in AudioEngine in the future again. Any plans about it? With it, we can make stunning slow motion effects O_O

Thanks!
fryderyk

Posts: 1

Participants: 1

Read full topic


SDKBOX analytics installation error

$
0
0

@jerry_afr wrote:

Hi,
When I try to import google analytics via sdkbox into my project, I get the following error:
"failed to find parent application/receiver
Installation failed :("

In the log files, I see the following error:

Traceback (most recent call last):
File "monolith.py", line 6600, in perform
File "monolith.py", line 6608, in perform
File "monolith.py", line 7361, in android_add_element
File "monolith.py", line 1393, in add_element
RuntimeError: failed to find parent application/receiver

failed to find parent application/receiver
Installation failed :(
Performing at_exit cleanup.
Tracking: {'sdkbox_version': '1.0.0.17', 'cocos': '3.12.0', 'return_status': 'exception', 'cocos_installation': '3.12.0',     'backtrace': 'Traceback (most recent call last):\n  File "monolith.py", line 6600, in perform\n  File "monolith.py", line     6608, in perform\n  File "monolith.py", line 7361, in android_add_element\n  File "monolith.py", line 1393, in add_element\nRuntimeError: failed to find parent application/receiver\n', 'args': {'verbose': 0, 'installer': 'C:/Users/Afshar/.sdkbox/bin/sdkbox.pyc', 'manifest': 'manifest.json', 'nopatching': 0, 'patcherrors': 0, 'project': 'D:/lipinic/Strategist/strategist/', 'noupdate': 0, 'mvalue': None, 'nopatchingcpp': 0, 'local': 0, 'nohelp': 0, 'dryrun': None, 'jsonapi': 0, 'symbol': None, 'mkey': None, 'info': None, 'remote': 0, 'plugin': 'C:/Users/Afshar/.sdkbox/plugins/sdkbox-googleanalytics_v2.3.1.1/', 'forcecopy': 0, 'days': 10, 'server': 'download.sdkbox.com/installer/v1/', 'forcedownload': 0, 'command': 'import', 'alwaysupdate': 0}, 'exception': 'failed to find parent application/receiver'}

Any help is appreciated.
Thanks

Posts: 1

Participants: 1

Read full topic

Bug: Scene preview (added into the current scene)

$
0
0

@oneguy wrote:

Hi all,

I'm currently porting my game to cocos2d-x 3.13 from 3.0, I have a preview of each level in a screen just before launching the actual level to play.

There is a strange behavior that I was able to reproduce on the HelloWorld sample test:

I just add a new HelloWorld scene to the Helloworld scene (just one time) and it seems that it's displayed 4 times with different scaling:

here is the code if you want to reproduce on your side (just create a new project and replace the HelloWorldScene.h and HelloWorldScene.cpp with this) :

HelloWorldScene.h

#ifndef __HELLOWORLD_SCENE_H__
#define __HELLOWORLD_SCENE_H__

#include "cocos2d.h"

class HelloWorld : public cocos2d::Layer
{
public:
    static cocos2d::Scene* createScene();

    virtual bool init();
    
    // a selector callback
    void menuCloseCallback(cocos2d::Ref* pSender);
  
    static bool stop;
    // implement the "static create()" method manually
    CREATE_FUNC(HelloWorld);
};

#endif // __HELLOWORLD_SCENE_H__

HelloWorldScene.cpp

#include "HelloWorldScene.h"
#include "SimpleAudioEngine.h"

USING_NS_CC;

 bool HelloWorld::stop = false;

Scene* HelloWorld::createScene()
{
    // 'scene' is an autorelease object
    auto scene = Scene::create();
    
    // 'layer' is an autorelease object
    auto layer = HelloWorld::create();

    // add layer as a child to scene
    scene->addChild(layer);

    // return the scene
    return scene;
}

// on "init" you need to initialize your instance
bool HelloWorld::init()
{
    //////////////////////////////
    // 1. super init first
    if ( !Layer::init() )
    {
        return false;
    }
    
    auto visibleSize = Director::getInstance()->getVisibleSize();
    Vec2 origin = Director::getInstance()->getVisibleOrigin();

    /////////////////////////////
    // 2. add a menu item with "X" image, which is clicked to quit the program
    //    you may modify it.

    // add a "close" icon to exit the progress. it's an autorelease object
    auto closeItem = MenuItemImage::create(
                                           "CloseNormal.png",
                                           "CloseSelected.png",
                                           CC_CALLBACK_1(HelloWorld::menuCloseCallback, this));
    
    closeItem->setPosition(Vec2(origin.x + visibleSize.width - closeItem->getContentSize().width/2 ,
                                origin.y + closeItem->getContentSize().height/2));

    // create menu, it's an autorelease object
    auto menu = Menu::create(closeItem, NULL);
    menu->setPosition(Vec2::ZERO);
    this->addChild(menu, 1);

    /////////////////////////////
    // 3. add your codes below...

    // add a label shows "Hello World"
    // create and initialize a label
    
    auto label = Label::createWithTTF("Hello World", "fonts/Marker Felt.ttf", 24);
    
    // position the label on the center of the screen
    label->setPosition(Vec2(origin.x + visibleSize.width/2,
                            origin.y + visibleSize.height - label->getContentSize().height));

    // add the label as a child to this layer
    this->addChild(label, 1);

    // add "HelloWorld" splash screen"
    auto sprite = Sprite::create("HelloWorld.png");
    sprite->setOpacity(128);
    // position the sprite on the center of the screen
    sprite->setPosition(Vec2(visibleSize.width/2 + origin.x, visibleSize.height/2 + origin.y));

    // add the sprite as a child to this layer
    this->addChild(sprite, 0);
  
    if (stop == false) {
      sprite->setScaleY(-1.0f);
      HelloWorld::stop = true;
      auto previewscene = HelloWorld::createScene();
      previewscene->setScale(0.25f, 0.25f);
      this->addChild(previewscene);
    }
    return true;
}


void HelloWorld::menuCloseCallback(Ref* pSender)
{
    //Close the cocos2d-x game scene and quit the application
    Director::getInstance()->end();

    #if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
    exit(0);
#endif
    
    /*To navigate back to native iOS screen(if present) without quitting the application  ,do not use Director::getInstance()->end() and exit(0) as given above,instead trigger a custom event created in RootViewController.mm as below*/
    
    //EventCustom customEndEvent("game_scene_close_event");
    //_eventDispatcher->dispatchEvent(&customEndEvent);
    
    
}

I would appreciate any help you could provide

Thanks in advance!

Posts: 2

Participants: 1

Read full topic

SPINE how to mix (interpolate) between animations

$
0
0

@crugthew wrote:

Hello,

We have tried a lot of times and never quite figured out how to mix (interpolate) animations. Searching the web also never provided a good and clear tutorial on the topic, so maybe one of you has a solution for cocos2d-x c++ and not spine runtimes for c# or something similar.

The way we work with animations so far is that out animation designer works very carefully to make them seem transition nicely, but it is a long and tiring task.

This is how we're working right now as and example:

animation->setAnimation(0, "idle", true);
// and on some event
animation->clearTracks();
animation->setAnimation(1, "from_idle_to_running", false);
// and when that finishes playing
animation->clearTracks();
animation->setAnimation(2, "running_idle", true);

Can anyone shed light on correct mixing examples for cocos2d-x c++ spine animations? Thank you.

Posts: 1

Participants: 1

Read full topic

XCode 8 and Cocos2d-x

(solved) Quick simple job

$
0
0

@pebulusek wrote:

Hi, I am trying to save time. Could someone send me XCode iOS (mobile) Hello world project with newest Cocos2D-X C++ version and integrated Box2D library (statically linked)? For example only create Box2D b2World object in Helloworldscene so that I see that it works. For 50$.

Posts: 5

Participants: 3

Read full topic

APK Crash due to cc.director.getWinSize()

$
0
0

@lukenikolov wrote:

cc.view.setDesignResolutionSize(cc.director.getWinSize().width, cc.director.getWinSize().height, cc.ResolutionPolicy.SHOW_ALL);

this row in onStart function in Main.js crashes APK .
in v.3.6.1 there was not such a problem. Now I decide to update to 3.13 version and it appears.

How can I remove the problem. I used cc.director.getWinSize(). over 100 times in my game.
Please Help!!!

Posts: 1

Participants: 1

Read full topic

Tune plugin crash (JS)

$
0
0

@pandemosth wrote:

Another plugin crashing intermittently within the listener callback. Who is managing bugs for SDKBOX?
(Cocos2d-x 3.12, tune plugin 2.3.1.1)

Crashed: NSOperationQueue 0x13fe990e0 :: NSOperation 0x143de83c0 (QOS: LEGACY)
EXC_BAD_ACCESS KERN_INVALID_ADDRESS 0x6000000004102810

Crashed: NSOperationQueue 0x13fe990e0 :: NSOperation 0x143de83c0 (QOS: LEGACY)
0  battlestars-afl-iOS            0x100779a3c cocos2d::Scheduler::schedule(void (cocos2d::Ref::*)(float), cocos2d::Ref*, float, unsigned int, float, bool) + 3592328
1  battlestars-afl-iOS            0x100080528 TuneListenerJs::onMobileAppTrackerDidSucceedWithData(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) (PluginTuneJSHelper.cpp:33)
2  battlestars-afl-iOS            0x1001354cc sdkbox::PluginTune::setDeepLink(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) + 4296660172
3  battlestars-afl-iOS            0x1000ee3e8 -[TuneTracker notifyDelegateSuccessMessage:] + 4296369128
4  battlestars-afl-iOS            0x1000f047c -[TuneTracker queueRequestDidSucceedWithData:] + 4296377468
5  battlestars-afl-iOS            0x1000d7728 __27-[TuneEventQueue dumpQueue]_block_invoke_2 + 4296275752
6  battlestars-afl-iOS            0x1000d74bc __27-[TuneEventQueue dumpQueue]_block_invoke + 4296275132
7  Foundation                     0x182890540 __NSBLOCKOPERATION_IS_CALLING_OUT_TO_A_BLOCK__ + 16
8  Foundation                     0x1827e2870 -[NSBlockOperation main] + 96
9  Foundation                     0x1827d2e48 -[__NSOperationInternal _start:] + 604
10 Foundation                     0x182892934 __NSOQSchedule_f + 224
11 libdispatch.dylib              0x18192147c _dispatch_client_callout + 16
12 libdispatch.dylib              0x18192d4c0 _dispatch_queue_drain + 864
13 libdispatch.dylib              0x181924f80 _dispatch_queue_invoke + 464
14 libdispatch.dylib              0x18192f390 _dispatch_root_queue_drain + 728
15 libdispatch.dylib              0x18192f0b0 _dispatch_worker_thread3 + 112
16 libsystem_pthread.dylib        0x181b39470 _pthread_wqthread + 1092
17 libsystem_pthread.dylib        0x181b39020 start_wqthread + 4

Posts: 1

Participants: 1

Read full topic


Copy to clipboard?

$
0
0

@shipit wrote:

I want the users of my game to be able to copy their UUID to clipboard so they can send us an email and paste that UUID in the email app. How do I go about doing this? Basically tap a Label and copy to clipboard.

thx!

Posts: 2

Participants: 2

Read full topic

Opacity Spine animation in Cocos Creator

Prebuilt generation not working in 3.13.1 and 3.11.1

$
0
0

@crittergorge wrote:

hello there,
i'm trying to generate prebuilts with cocos command but i stumble into errors. does anyone know a workaround?

----- trying prebuilt 3.13.1

max:cocos2d-x-3.13.1 cocos gen-libs -c -p android

Updated project.properties
Updated local.properties
Updated file /usr/local/cocos/cocos2d-x-3.13.1/cocos/platform/android/java/proguard-project.txt
Building native...
NDK build mode: release
running: '/usr/local/android/ndk-bundle/ndk-build -C /usr/local/cocos/cocos2d-x-3.13.1/tools/simulator/frameworks/runtime-src/proj.android -j4 APP_ABI="armeabi" NDK_MODULE_PATH=/usr/local/cocos/cocos2d-x-3.13.1/tools/simulator/frameworks/runtime-src/proj.android/../../../../../:/usr/local/cocos/cocos2d-x-3.13.1/tools/simulator/frameworks/runtime-src/proj.android/../../../../../cocos/:/usr/local/cocos/cocos2d-x-3.13.1/tools/simulator/frameworks/runtime-src/proj.android/../../../../../external:/usr/local/cocos/cocos2d-x-3.13.1/tools/simulator/frameworks/runtime-src/proj.android/../../../../../cocos/scripting NDK_TOOLCHAIN_VERSION=4.9'

[armeabi] StaticLibrary : libluacocos2d.a
[armeabi] StaticLibrary : libsimulator.a
[armeabi] StaticLibrary : libjscocos2d.a
[armeabi] StaticLibrary : libcocos2d.a
[armeabi] StaticLibrary : liblocalstorage.a
[armeabi] StaticLibrary : libcocostudio.a
[armeabi] StaticLibrary : libcocosbuilder.a
[armeabi] StaticLibrary : libcocos3d.a
[armeabi] StaticLibrary : libspine.a
[armeabi] StaticLibrary : libui.a
[armeabi] StaticLibrary : libcocosdenshion.a
[armeabi] StaticLibrary : flatbuffers.a
[armeabi] StaticLibrary : libextension.a
[armeabi] StaticLibrary : libaudioengine.a
[armeabi] StaticLibrary : libbox2d.a
[armeabi] StaticLibrary : libnetwork.a
[armeabi] StaticLibrary : libcocos2dxinternal.a
[armeabi] StaticLibrary : librecast.a
[armeabi] StaticLibrary : libbullet.a
[armeabi] StaticLibrary : libluacocos2dandroid.a
[armeabi] StaticLibrary : libjscocos2dandroid.a
[armeabi] StaticLibrary : libcocos2dandroid.a
[armeabi] StaticLibrary : libcpufeatures.a
[armeabi] SharedLibrary : libcocos2dlua.so
/usr/local/cocos/cocos2d-x-3.13.1/tools/simulator/frameworks/runtime-src/proj.android/../../../../../cocos//./base/CCConsole.cpp:423: error: undefined reference to 'bzero'
collect2: error: ld returned 1 exit status
make: *** [obj/local/armeabi/libcocos2dlua.so] Error 1
Error running command, return code: 2.
Error running command, return code: 14.
max:cocos2d-x-3.13.1

----- trying prebuilt 3.11.1

max:cocos2d-x-3.11.1 cocos gen-libs -c -p android

Building native...
NDK build mode: release
running: '/usr/local/android/ndk-bundle-r10e/ndk-build -C /usr/local/cocos/cocos2d-x-3.11.1/tools/simulator/frameworks/runtime-src/proj.android -j4 APP_ABI="armeabi" NDK_MODULE_PATH=/usr/local/cocos/cocos2d-x-3.11.1/tools/simulator/frameworks/runtime-src/proj.android/../../../../../:/usr/local/cocos/cocos2d-x-3.11.1/tools/simulator/frameworks/runtime-src/proj.android/../../../../../cocos/:/usr/local/cocos/cocos2d-x-3.11.1/tools/simulator/frameworks/runtime-src/proj.android/../../../../../external:/usr/local/cocos/cocos2d-x-3.11.1/tools/simulator/frameworks/runtime-src/proj.android/../../../../../cocos/scripting NDK_TOOLCHAIN_VERSION=4.9'

Android NDK: WARNING: Unsupported source file extensions in /usr/local/cocos/cocos2d-x-3.11.1/tools/simulator/frameworks/runtime-src/proj.android/../../../../../cocos//scripting/js-bindings/proj.android/Android.mk for module cocos2d_js_static
Android NDK: \
make: Entering directory /usr/local/cocos/cocos2d-x-3.11.1/tools/simulator/frameworks/runtime-src/proj.android'
[armeabi] Compile++ arm : cocos2dlua_shared <= main.cpp
[armeabi] Compile++ arm : cocos2dlua_shared <= AppDelegate.cpp
[armeabi] Compile++ arm : cocos2dlua_shared <= RuntimeJsImpl.cpp
[armeabi] Compile++ arm : cocos2dlua_shared <= RuntimeLuaImpl.cpp
make: *** No rule to make target
/Applications/Cocos/Cocos2d-x/cocos2d-x-3.11.1/tools/simulator/frameworks/runtime-src/proj.android/../../../../../cocos//scripting/lua-bindings/proj.android/../manual/CCLuaBridge.cpp', needed byobj/local/armeabi/objs/cocos2d_lua_static/__/manual/CCLuaBridge.o'. Stop.
make: *** Waiting for unfinished jobs....
[armeabi] Compile arm : cocos2dlua_shared <= lua_debugger.c
make: Leaving directory
/usr/local/cocos/cocos2d-x-3.11.1/tools/simulator/frameworks/runtime-src/proj.android'
Error running command, return code: 2.
Error running command, return code: 14.
max:cocos2d-x-3.11.1

----- setup

os x el capitan
xcode 7
cocos2dx 3.11.1 / 3.13.1
cmake version 3.3.2
ndk r10e / r12b

Posts: 3

Participants: 2

Read full topic

How to save image in photos in windows universal app c++?

$
0
0

@SnkTest wrote:

in windows phone universal app in c++ i want to save image in device storage .
i take screenshot using render texcher and save file to cache but how to save it in photo library

Posts: 4

Participants: 2

Read full topic

Dose Android release mode execute faster

$
0
0

@RazerJack wrote:

Dose release code execute faster on a an android devise rather than debug mode i can't find this out as i don't have a store key yet and won't be getting one till project is finished. I'm compiling to and running on hardware device's not emulators.
I neet to know as I'm optimising code and still getting lag and want to know do i get extra free speed just for release mode.
Thanks in advance.

Posts: 2

Participants: 2

Read full topic

Significant Issue - Drawing corrupted when open app right after installation

$
0
0

@StanLeung wrote:

Hi All,

I am using 3.10 to develop android game. Then I find that if I select android's "open" button right after android app installation. First time it is fine, but if I press android's "Home" button then come back, the screen will corrupted, seems the resolution reduce to half of its original screen size, some picture goes into dark color, some transparent boxes are drawn on top of sprite, and! Although all pictures are drawn in incorrect position, but if I touch its original position, it still works...You can imagine that all UI object are projected into another smaller view port. Seems all UI created from CSB file are affected. Don't know why, text label are not affected, all sprite / imageview / layout are failed.

Just found that this behavior also happened on cocos2d cpp-test. You can try it in test case 15.CocosStudio3DTest -> 5. CocosStudio SkyBox Test.

But, if I don't press "open" at step 1, I press "Done" then open app on my android home screen, this behavior won't occur. Why will be like this? Does anyone get the same problem? Really no idea how to fix it...

Posts: 2

Participants: 1

Read full topic

Cocos Creator crashes to blank screen when compiling and/or when assetDB is working

$
0
0

@Alekhine wrote:

Several times a day I experience Cocos Creator crashes when compiling, when editing prefabs or when I've added new
files which the assetDB are importing.

The program doesn't crash, that is to say, it doesnt shut down, instead the screen goes blank and I can only access the uppermost status bar(files, edit etc. dropdown menus), when I hit reload, the message that caused the crash is revealed which is:

I am using v1.2.1-rc.1

Posts: 2

Participants: 2

Read full topic


How to draw line in cocos2d-x 3.13

Masking image problem

$
0
0

@shashankA wrote:

Hi Everyone,

I am masking an image using this method.

    // Create a mask
    var maskSprite = new cc.Sprite(spriteFrameCache.getSpriteFrame("mask.png"));
    // maskSprite.setBlendFunc(cc.ONE, cc.ZERO);
    maskSprite.setPosition(maskSprite.width / 2, maskSprite.height / 2);

    var puzzleImage = new cc.Sprite(spriteFrameCache.getSpriteFrame("puzzle.png"));

    puzzleImage.setBlendFunc(cc.DST_ALPHA, cc.ONE_MINUS_DST_ALPHA);


    puzzleImage.setPosition(maskSprite.width / 2, maskSprite.height / 2);

    var cs = maskSprite.getBoundingBox();
    var rendererTexture = new cc.RenderTexture(cs.width, cs.height);

    rendererTexture.beginWithClear(0, 0, 0, 0);
    // rendererTexture.begin();

    maskSprite.visit();
    puzzleImage.visit();

    rendererTexture.end();

    var rtSprite = new cc.Sprite();
    rtSprite.initWithTexture(rendererTexture.getSprite().getTexture());
    rtSprite.getTexture().setAntiAliasTexParameters();
    rtSprite.flippedY = true;

    rtSprite.setPosition(500,450);
    this.addChild( rtSprite,20);

I am getting correct result once i added this in scene but switching scene back and forth its creating bug.

Something Like - RendererWebGL.js:314 Uncaught TypeError: Cannot read property 'indexOf' of undefined

Please help me...

Posts: 1

Participants: 1

Read full topic

Can I rename a Cocos Creator project?

$
0
0

@jrosich wrote:

Is there an easy way to copy and rename a Cocos Creator project?
I want to create a template project with basic game logic (my game mechanics engine).
So I can later create a batch of games with it.

Thanks!

Posts: 3

Participants: 2

Read full topic

Need help getting started with Cocos2d-x

$
0
0

@Smorri wrote:

Sorry if this is the wrong place for this post...

My background is with C++ and I am trying to get Cocos2d-x up and running while looking for some help initially running/using Cocos2d-x. So far a lot of the links I've found seem to be out of date with the latest version. Currently I'm reading the Programmer's Guide, but I'm still not sure what I need to install to get the latest version of Cocos2d-x running with the goal of developing for Android and eventually iOS.

Also, I was looking at Cocos2d-x by Example: Beginner's Guide - Second Edition ("https://www.amazon.com/Cocos2d-x-Example-Beginners-Guide-Second/dp/1785288857/ref=sr_1_1?s=books&ie=UTF8&qid=1473813033&sr=1-1&keywords=Cocos2d-x"). It seems to gotten good reviews, but does anyone if this is too out of date with the latest version of Cocos2d-x?

Thanks in advance!

Posts: 6

Participants: 2

Read full topic

C++ support for Cocos Creator

$
0
0

@ricardo wrote:

I'll work on adding C++ support for Cocos Creator.

This thread will be my "personal blog" about it.

1st impressions:

  • Cocos Creator is NOT 100% compatible with cocos2d-x.
  • It uses a component based model to build scenes
  • it supports JavaScript scripts
  • it has its own "nodes" (prefabs)
  • project files are saved in a ".fire" (json format)
  • We recently added Lua support, which means that from cocos2d-x + lua you can run ".fire" files with certain limitations.

So, my plan is:

  • Generate an intermediate file out from the .fire files. Most probably an python script. This script will do all the hard work. Basically converting the component-based scene (cocos creator) into a node-based scene (cocos2d-x)
  • Not all prefabs / components will be converted. Raise a warning when that happens
  • Learn from the Lua support files, since they already triggered those limitations. Unfortunately they are not generating an intermediate file. Instead they are parsing the .fire files in runtime.

Basically I start prefab by prefab and see what can be converted and what not.

Posts: 18

Participants: 7

Read full topic

Viewing all 17112 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>