cocos2d-x

Linking errors when adding AdMob to IOS cocos2d-x 3.2

我们两清 提交于 2019-12-05 05:59:14
i trying to add AdMob to cocos2d-x 3.2 simple game using Xcode 5.1 iOS 7.1 i following the tutorials in https://developers.google.com/mobile-ads-sdk/docs/#ios and http://plaincode.blogspot.co.il/2014/02/example-of-admob-integration-in-cocos2d.html and after adding the -ObjC flag in the "Other Linker Flags" I'm getting linking errors: Undefined symbols for architecture armv7s: "_GCControllerDidDisconnectNotification", referenced from: -[GCControllerConnectionEventHandler observerConnection:disconnection:] in libcocos2dx iOS.a(CCController-iOS.o) "_GCControllerDidConnectNotification", referenced

Cocos2d-x - how to set part of CCLayer transparent?

一曲冷凌霜 提交于 2019-12-05 02:48:38
问题 I'm newbie in cocos2d-x and I need your help. I need to make transparent a touched portion of the layer. How to make a portion of the layer transparent? I had thought to use ССClippingNode , but I'm not find examples or docs. I use C++. Thanks. 回答1: In TestCpp, project that was added to all cocos2d-x version, you can find examples of CCClipingNode. If you want to hide part of CCNode(for example "layer") using CCClipingNode, you should add your layer to CCClipingNode. This is the example that

cocos2d-x CCTouchDispatcher - no sharedDispatcher

青春壹個敷衍的年華 提交于 2019-12-05 02:37:09
I'm currently porting an ObjC cocos2d game to cocos2d-x, but I'm encountering some problems when trying to create a registerWithTouchDispatcher method, at the moment I'm doing void GameLayer::registerWithTouchDispatcher() { CCTouchDispatcher::sharedDispatcher()->addTargetedDelegate(this,0,true); } but this gives an error 'No member named sharedDispatcher' in cocos2d::CCTouchDispatcher'. Is there another way that this must be done in cocos2d-x? If you are using 2.0, they have been merged in to CCDirector. please use CCDirector::sharedDirector()->getTouchDispatcher() zszen use those code instead

Cocos2d-JS自定义粒子系统

假如想象 提交于 2019-12-05 01:21:20
除了使用Cocos2d-JS的11种内置粒子系统外,我们还可以通过创建ParticleSystem对象,并设置属性实现自定义粒子系统,通过这种方式完全可以实现我们说需要的各种效果的粒子系统。使用ParticleSystem自定义粒子系统至少有两种方式可以实现:代码创建和plist文件创建。 代码创建粒子系统需要手工设置这些属性,维护起来非常困难,我们推荐使用Particle Designer等粒子设计工具进行所见即所得的设计,这些工具一般会生成一个描述粒子的属性类表文件plist,然后通过类似下面的语句加载: var particleSystem = new cc.ParticleSystem("res/snow.plist"); snow.plist是描述运动的属性文件,plist文件是一种XML文件,参考代码如下: [html] view plain copy <? xml version = "1.0" encoding = "UTF-8" ?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd" > < plist version = "1.0" > < dict > < key > angle </ key > <

Check If animation is running in cocos2d-x

我只是一个虾纸丫 提交于 2019-12-05 00:37:13
问题 I am currently learning cocos2D-x and am doing some sprite animation. My Objective is that when a button is clicked the object moves to left with some animation. Now if you click multiple times rapidly the animation takes place immediately and it looks like the bear is hoping instead of walking. The solution to it looks simple that I should check if animation is already running and if running the new animation should not take place. The following is a part of my code. CCSpriteFrameCache:

Use database (such as sqlite) with cocos2d-x

只愿长相守 提交于 2019-12-05 00:10:12
问题 I am starting to build a gaming application on iphone. I am using cocos2d-x game engine, since it is easy to port to android from there. Also the coding is in C++, which I am very much familiar with. I want to know if there is a way to use any database with cocos2d-x. Although sqlite is preferred but not mandatory. I will have about 1/2 mb of data in the database. So, yes I have thought about keeping/using an in-memory database too, but I want my read/write queries to be time efficient. I

Cocos2d-x开发中C++内存管理

一世执手 提交于 2019-12-04 23:40:29
由于开始并没有介绍C++语言,C++的内存管理当然也没进行任何的说明,为了掌握Cocos2d-x中的内存管理机制,是有必要先了解一些C++内存管理的知识。 C++内存管理非常复杂,如果完全地系统地介绍可能需要一本书的篇幅才能解释清楚。这里只给大家介绍C++内存管理最为基本的用法。 内存分配区域 创建对象需要两个步骤:第一步,为对象分配内存,第二步,调用构造函数初始化内存。在第一步中对象分配内存时候,我们可以选择几个不同的分配区域,这几个区域如下: 栈区域分配。栈内存分配运算内置于处理器的指令集中,效率很高,但是分配的内存容量有限。由处理器自动分配和释放,用来存放函数的参数值和局部变量的值等。在执行函数时,函数内局部变量的存储单元都可以在栈上创建,函数执行结束时这些存储单元自动被释放。 堆区域分配。从堆上分配,亦称动态内存分配。由开发人员分配释放,如果不释放,程序结束时由操作系统回收。 程序在运行的时候用malloc或new申请任意多少的内存,开发人员自己负责在何时用free或delete释放内存。动态内存的生存期由开发人员决定,使用非常灵活,但问题也最多。 在静态存储区域分配。这个内存空间在程序的整个运行期间都存在,内存在程序编译的时候就已经分配好。它可以分配全局变量和静态变量。 动态内存分配 动态内存分配最为灵活但是问题也很多,我们重点介绍动态内存分配

Cocos2d-x on Android Studio - New CPP files are not listed

房东的猫 提交于 2019-12-04 20:16:33
Android Studio 2.3.3 (LATEST) Cocos2d-x 3.15.1 (LATEST) It's my first experience with Cocos2d-x Game Engine, I encountered a lot of problems. The first time I tried the latest NDK of Android Studio but there is a bug on this NDK version when I tried to compile my project with : cocos compile -p android --android-studio so I change the NDK version to 13b. When I changed to NDK 13b the compilation was done without any problems and android studio build my project successfully but when I tried to create new CPP FILE or JAVA FILE or anything inside the Classes folder , Android Studio It does not

第一个Cocos2d-JS游戏

爷,独闯天下 提交于 2019-12-04 19:29:00
我们的编写的第一个Cocos2d-JS程序,命名为HelloJS,从该工程开始学习其它的内容。 创建工程 我们创建Cocos2d-JS工程可以通过Cocos2d-x提供的命令工具cocos实现,但这种方式不能与WebStorm或Cocos Code IDE集成开发工具很好地集成,不便于程序编写和调试。由于Cocos Code IDE工具是Cocos2d-x开发的专门为Cocos2d-JS和Cocos2d-x Lua开发设计的,因此使用Cocos Code IDE工具很方便创建Cocos2d-JS工程。 首先我们需要在Cocos Code IDE工具中先配置JavaScript框架,打开Cocos Code IDE工具,选择菜单Window→Preferences,弹出对话框如下图所示,选择Cocos→JavaScript在右边的JavaScript Frameworks中选择<Cocos2d-JS引擎目录>。 配置JavaScript框架 JavaScript框架配置不需要每次都进行,只是在最开始的配置一下,但创建工程的时候,Cocos Code IDE工具会从这个JavaScript框架目录中创建工程文件。 接下来我们就可以创建JavaScript工程了,选择菜单File→New→Project,如下图所示,弹出项目类型选择对话框。 项目类型选择对话框 我们选中Cocos

Call to C++ JNI NewStringUTF crashes android app when using many different kinds of emoji and languages (beyond ascii, but still valid modified utf-8)

孤者浪人 提交于 2019-12-04 18:57:39
I am trying to solve a Cocos2d-x Keyboard input crash on Android 5.x when I create CCImage from the text with many emoji found on the keyboard (some work though, but most don't.) On Android 4.x several of the devices just display mangled text/extra characters. The source of the crash is the JNI's NewStringUTF() call. It simply does not support all of the 2, 3 and 4 byte utf-8 characters in Android 5/Lollipop. This crash happens on cocos2d-x v2.2.6 (and confirmed on 3.x) using NDK 10e with Toolchain 4.8 (not sure if any of that makes too much of a difference, we were using 9d prior to moving to