cocos2d-x

glError 0x0501 when loading a large texture with OpenGL ES on the iPhone4

大憨熊 提交于 2019-12-06 15:35:24
I got this error when I try to load a PVR image on device. It works in iPhone 5s, 5, 4s and iPad well, but in 4 it doesn't work. My PVR image size is: width = 4096 and height = 2048 . Cocos2d: cocos2d: TexturePVR: Error uploading compressed texture level: 0 . glError: 0x0501 Cocos2d: cocos2d: Couldn't load PVR image /var/mobile/Applications/7CF6C347-8B63-4C1E-857A-41F48C8ACBEF/Race.app/Images/BackGround/bg1.pvr.ccz Cocos2d: cocos2d: Couldn't add PVRImage:Images/BackGround/bg1.pvr.ccz in CCTextureCache I got this form this link : Supported sizes are: iPhone 3gs / iPhone 4 / iPad 1 / iPod 3 / 4

Cocos2dx 3.17 TileMap Basic Sample - wrong tilecord position, object layer itmes position returned also wrong

╄→尐↘猪︶ㄣ 提交于 2019-12-06 13:30:25
I tried cocos2d TileMap sample from here , In this tilecord returned for given player position is wrong. Here is code Point HelloWorld::tileCoordForPosition(Point position) { int x = position.x / mTileMap->getTileSize().width; int y = ((mTileMap->getMapSize().height * mTileMap->getTileSize().height) - position.y) / mTileMap->getTileSize().height; return Point(x, y); } Here is Map Screenshot Also tileCord returned is wrong. So collision is not working. I used it from sample in Ray Wenderlich site Here is full sample code https://app.box.com/s/whunv70tstwxbgzxdvxfeu080y6gwucb If anyone has time,

Cocos2d-x v3 Cannot override forward function Draw

北战南征 提交于 2019-12-06 10:05:00
问题 //in my .h file virtual void draw(); //in .cpp void GameLayer:draw() { Layer::draw(); //draw code goes here } It shows cannot override forward function node::draw() As far as I know, it was working on the old versions. Is there any new approach in cocos2d-x 3.0? Thanks in advance. 回答1: in v3.0 overriding the draw() method has changed. try in .h: virtual void draw(Renderer* renderer, const kmMat4& transform, bool transformUpdated); try in cpp: void draw(Renderer* renderer, const kmMat4&

How to compile Cocos2d-X with Marmalade?

时光总嘲笑我的痴心妄想 提交于 2019-12-06 08:42:50
问题 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. 回答1: I think this post on Marmalade forum may help you. 回答2:

AdMob Interstitial Cocos2d-x WP8

痞子三分冷 提交于 2019-12-06 08:22:41
问题 Can enyone tell me how to call AdMob Interstitial between scenes in my cocos2d-x game? I have tried this http://robwirving.com/2014/07/21/calling-c-methods-c-winrt-components/ guide, but i don't know how to run it from cocos classes. Is there any another ways, or some guides? 回答1: I've recently made it. You have to do few things. First of all create helper class, which will help you calling native function (I use this for all 3 platforms, but here's just windows phone): NativeHelper.h:

Running code on the main/UI thread in Cocos2dx

落爺英雄遲暮 提交于 2019-12-06 07:24:06
问题 Edit: So the issue was on the Java side. The purchase finished listener wasn't being called. This was very helpful: IabHelper PurchaseFinishedListener My Cocos2dx game runs fine on Android and iOS for the most part. Only think giving me trouble is Android In-App Billing. I'm using JNI to call from C++ to Java. The Java code goes back and forth w/ Google Play billing system and ultimately calls back to the C++ code indicating how much treasure to give to the user (amount successfully purchased

cocos2D or IwGame

情到浓时终转凉″ 提交于 2019-12-06 07:19:36
问题 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. 回答1: It

how to declare label in global class (helloworld.h) with cocos2d-x v3.2?

别来无恙 提交于 2019-12-06 04:57:35
I'm creating a 2d platform game with cocos2d-x v3.2 (c++) and i'm using label. cocos2d-x v3.0 (c++) declared like cocos2d::LabelTTF* currentScore; cocos2d-x v2.2.2 (c++) declared like cocos2d::CCLabelTTF* currentScore; cocos2d-x v3.2(c++) how to declare label in global class(helloworld.h) i have try like HelloWorld.h class HelloWorld : public cocos2d::LayerColor { public: virtual bool init(); cocos2d::LabelTTF* currentScore; //semantic issue(LabelTTF deprecared) }; #endif HelloWorld.cpp bool HelloWorld::init() { currentScore = LabelTTF::create("", "Arial", 40); //semantic issue(LabelTTF

Cocos2d-x: possible to use HTML (UIWebView)?

我怕爱的太早我们不能终老 提交于 2019-12-06 04:38:05
问题 I'm trying out cocos2d-x and got to the point where I can build the Javascript samples for Android and run them inside a browser as well. Now I want to create my own game, but coming from a HTML background, I'd rather use HTML tags with CSS than use Javascript to setup the user interface. I've read about UIWebView which can display HTML-pages in an app, but I was wondering if anyone has ever done this in combination with Cocos2D-x ? And could this be transparent, to overlay a normal cocos2d-x

jni call java method which take a custom java interface as parameter

老子叫甜甜 提交于 2019-12-06 03:45:35
问题 I'm working on a plugin project on cocos2d-x platform , I'd like to write some c++ wrapper interface to invoke java method through JNI from jar SDK . I know how to use JNI to invoke a static java method, but I'm confused by the interface parameter in the java function. I hava a cpp function pointer to handling callbacks: typedef void (* MyCallback)(int responseCode, string arg1, set<string> arg2); and I want to write a cpp wrapper method like : static void MyCpp::setTags(set<string> tags,