cocos2d-x

Cocos2D-x - Issues when with using CCFollow

断了今生、忘了曾经 提交于 2019-12-04 18:26:42
I've got a problem with CCFollow in Cocos2D-X. I want to follow my a Sprite, which is referred to a Box2D-Body. When i call this->runAction(CCFollow::create(playerSprite)); in the init method of my GameLayer, the lower left corner of my usual screen is centered on my device and although the emulator. May anyone help me with this issue ? :/ Best Regards, stotheg ССFollow is often not enough for your own purposes. One way out of this situation is to create your custom ССFollow action or adding the required logic in the game loop. Please read this article, there's a lot of useful information for

[cocos2dx android]Rendering CCSprite using raw data from Bitmap

自古美人都是妖i 提交于 2019-12-04 17:46:00
I am trying to fetch an image from a URL into a Bitmap and then using the raw data from the Bitmap am trying to create a CCSprite. The issue here is that the image is corrupted when I display the sprite. I created a standalone android only application(no cocos2dx) and used the same code to fetch and display the Bitmap and its displayed correctly. Any reason why the image is not being properly rendered in cocos2dx? My code to fetch the image from the URL is: String urlString = "http://www.mathewingram.com/work/wp-content/themes/thesis/rotator/335f69c5de_small.jpg";//http://graph.facebook.com/"

Has anyone run their game on Higher Resolution in Cocos2d-android?

≡放荡痞女 提交于 2019-12-04 16:32:14
CCScene doesn't show anything on higher resolution ? I am working on a project in which I'm using the cocos2d_android.jar and on the 4.3 version the screen goes blank and music/ccTouches/others things working fine. Even after I change the jar file with the API level 18(4.3 version), Add into my project and there is no error in the import time and uses their classes but in the RunTimeError occurred like : 09-14 07:49:49.890: E/AndroidRuntime(1282): FATAL EXCEPTION: GLThread 102 09-14 07:49:49.890: E/AndroidRuntime(1282): java.lang.NullPointerException 09-14 07:49:49.890: E/AndroidRuntime(1282):

What does “[ this ]” mean in C++

烈酒焚心 提交于 2019-12-04 14:57:19
问题 When I was reading the Cocos2dx 3.0 API, I found something like this: auto listener = [this](Event* event){ auto keyboardEvent = static_cast<EventKeyboard*>(event); if (keyboardEvent->_isPressed) { if (onKeyPressed != nullptr) onKeyPressed(keyboardEvent->_keyCode, event); } else { if (onKeyReleased != nullptr) onKeyReleased(keyboardEvent->_keyCode, event); } }; What does [this] mean? Is this new syntax in C++11 ? 回答1: What does [this] means? It introduces a lambda - a callable function object

cocos2d-x引擎库binary版本制作(Windows环境)

ぃ、小莉子 提交于 2019-12-04 14:40:51
大家可能觉得很奇怪,cocos2d-x引擎库的编译不是很简单嘛?不就是下载源码包,解压并打开vs工程,分别对debug跟release两个版本按一下编译就好了吗?对的,编译就这样就完成了。不过,我发现这样编译出来的库好像“移植性”不是很好,不能直接拷贝到另外一台电脑直接使用。于是,我尝试将这个编译好的引擎库变得更加的有“移植性”,并分享这个过程。 (这里的“移植性”之所以用分号,是因为这不是说这个库不能移植到不同平台,而是说不能知道拷贝到其他电脑,然后直接使用。) ------------------------------------------------------------- 首先,说明一下我为什么要干这个引擎库拷贝的事情。是这样的:我本来有个台式机,已经配置好cocos2d-x环境了,然后最近买了手提。于是我想在手提上也装个cocos2d-x环境。然后我想,既然cocos2d-x是一个C++编写的函数库(引擎框架),理论上应该是可以直接拷贝到另外一台电脑使用的。于是我把台式的编译好的cocos2d-x库拷贝到了手提,结果编译一个HelloWorld都要整个cocos2d-x重新编译一次。所以,一台电脑编译,拷贝到另一台电脑使用的想法似乎有问题。 -------------------------------------------------------------

Rounded Corners Rect in Cocos 2d-x with Bezier

跟風遠走 提交于 2019-12-04 14:39:47
Is it possible to draw a Rect with rounded corners using a DrawNode object? I think that something is possible using Bezier curves, but I have made some tries and I think I can't handle it. Looking at API I've found only these 2 functions: drawQuadBezier (const Vec2 &origin, const Vec2 &control, const Vec2 &destination, unsigned int segments, const Color4F &color) drawCubicBezier (const Vec2 &origin, const Vec2 &control1, const Vec2 &control2, const Vec2 &destination, unsigned int segments, const Color4F &color) [Modified after answer] I have applied the answer in Cocos2dx , maybe somebody

How to compile Cocos2d-X with Marmalade?

喜夏-厌秋 提交于 2019-12-04 14:15:07
Does any body know a tutorial, or a three simple step in order to compile the code the I wrote with Cocos2d-x with Marmalade? I want to take the code I already compiled and used in Cocos2d-X, insert into a marmalade project, and compile. In lots of places is written as easy, but I have difficult with this. I'll really appreciate if someone has some easy step to follow: "Maramalade + cocos2d-x for dummies style :) " Thanks, Adrian. I think this post on Marmalade forum may help you. The latest version include project mkb for helloworld and tests follow them. 来源: https://stackoverflow.com

cocos2d-x android set up error - java.lang.NullPointerException

一笑奈何 提交于 2019-12-04 12:34:05
问题 I'm trying to set up cocos2d-x for android and I followed a video tutorial I passed the steps for terminal without any problem ( setup.py command result is as expected). My problem is after I set NDK_ROOT in C/C++ Build - environment section , I get some java.lang.NullPointerException exceptions. For example when I restart eclipse I get the following error. An internal error occurred during: "Android Library Update". java.lang.NullPointerException When I try to reopen C/C++ Build -

cocos2D or IwGame

百般思念 提交于 2019-12-04 12:00:55
I started developing a game application for Android, but as I progress I decided to switch to cross-platform environment. Performance is very important as there is some complex audio processing on the background. After few days researching the subject I came to conclusion that the most successful option is Marmalade SDK. Now I need to decide if to use IwGame or Cocos2D-X or both for development. Both looks great and interesting. Have anyone used these and can share experience? Thanks. It depends on how much your game is dependent on the game engine. Cocos2D-x is more feature reach and heavy

Android JNI - Call function on Android UI thread from C++

[亡魂溺海] 提交于 2019-12-04 12:00:05
问题 Our game engine Cocos2d-x runs natively on android on its own non-Java-UI-thread . We need to call certain Java functions from C++ via JNI on the Android UI thread . For calling JNI-Functions , we're using the JNIHelper.h/cpp from here (GitHub): JniHelper.h, JniHelper.cpp For example this C++ code: auto retVal = JniHelper::callStaticStringMethod("org/utils/Facebook", "getFacebookTokenString"); Ideally, we'd like to have all these calls happen on the Android UI thread and pass an std::function