Questions tagged [cocos2d-x]

4

votes
2

answer
135

Views

Xiaolin Wu circle algorithm renders circle with holes inside

I've implemented Xiaolin Wu circle algorithm from here: https://create.stephan-brumme.com/antialiased-circle/ in c++: float radiusX = endRadius; float radiusY = endRadius; float radiusX2 = radiusX * radiusX; float radiusY2 = radiusY * radiusY; float maxTransparency = 127; float quarter = roundf(radi...
Makalele
1

votes
2

answer
6.8k

Views

Cocos2d-x - Understanding positioning sprites on screen

Can anyone provide some basic pointers on placing CCSprites on screen? Example: CCSize s = CCDirector::sharedDirector()->getWinSize(); With s, say I wanted to position a sprite on the very bottom of the screen starting at 0, think something like grass. if I am running at 1024 x 768, middle is: set...
Jason
1

votes
1

answer
442

Views

What is the use of setDesignResolutionSize in cocos studio?

In my appDelegate class i have code something like this, while using cocos studio auto glview = director->getOpenGLView(); if(!glview) { glview = GLViewImpl::createWithRect("HelloCpp", Rect(0, 0, 960, 640)); director->setOpenGLView(glview); } director->getOpenGLView()->setDesignResolutionSize(960,...
Mahesh
1

votes
2

answer
1.4k

Views

Errors after changed OpenGL code from ES 1.0 to ES 2.0

I changed code from ES 1.0 to ES 2.0 in cocos2d-x Code in ES 1.0 version const float DARK=30.0f; int n = m_sGridSize.x * m_sGridSize.y; glEnable(GL_CULL_FACE); glDisableClientState(GL_COLOR_ARRAY); glVertexPointer(3, GL_FLOAT, 0, m_pVertices); glTexCoordPointer(2, GL_FLOAT, 0, m_pTexCoordinates);...
refresh
1

votes
2

answer
1.6k

Views

OpenGL - Create a border over a textured polygon

I'm working with cocos2d-x 2.0.4. I illustrate what I am trying to do through these two images. convex_poly http://img542.imageshack.us/img542/2554/convexpoly.png convex_poly_with_border http://img40.imageshack.us/img40/8007/convexpolywithborder.png What i want to do is to create a blurred border or...
olma
1

votes
2

answer
1.8k

Views

error build cocos2dx android

I build cocos2d-x android project on windows 7. $. / Build_native.sh - run, and the process falls on Compile++ thumb : cocos2dx_static
user1881371
1

votes
1

answer
1.2k

Views

Inserting into SQLITE in cocos2d-x

I am using cocos2d-x to create an app in android which needs to use a database. I have used the following method, which I found whilst searching forums, to use SQLITE in cocos2d-x : use CCFileUtils::getFileData() to read the sqlite file into a char* use standard ofstrem to write the char* into a fil...
user2454986
1

votes
2

answer
580

Views

cocos2d-x 2.1.4 where is spriteWithTexture in version 2.1.4?

Im learning the new version of cocos2d-x 2.1.4 im porting cocos2d to x version , i want to port this section : spriteSheet = [CCSpriteBatchNode batchNodeWithFile:"foo.gif"]; player = [CCSprite spriteWithBatchNode:spriteSheet rect:CGRectMake(0, 0, 30, 56)]; to : spritSheet = CCSpriteBatchNode::crea...
user63898
1

votes
3

answer
531

Views

Cocos2d-x cross platform game development

I want to make a game with my friends on iOs, Android, WP operating systems. We decided to use a cocos2d-x and develop the core of the game on C++. What will be the right way of developing so that we can write the game all together simultaneously but just build the project differently on every platf...
Terko
1

votes
1

answer
1.1k

Views

How to detect mobile or tablet in Android NDK

I am developing a cocos2d-x application for Android devices. I would have two different screen configurations which are designed for mobile and tablet device formats. In the main.cpp I would like to add some logic which determines whether the device is tablet or mobile. This way I can load the appro...
don
1

votes
1

answer
7k

Views

How to install cocos 2d-x in visual studio, in window 8 operating system

How to install cocos2dx templates in VS2010 and how to create new cocos2dx project . I am installing cocos2d-x when i am import(cocos2d-win32.vc2010.sln) in VS2010 then whole cocos2dx are imported in VS2010 and it compile successfully also . but when i try to create new project my in cocos2dx. i go...
kapilsingh
1

votes
1

answer
1.1k

Views

How to use CCDirector and other changes in COCOS2D 3.0?

I have to convert my game into new version of cocos2dx. I have finished to conversion but got deprecated the followings. COCOS2DX-2.X COCOS2DX-3.X sharedDirector()->getWinSize() -> ? SpriteFrameCache::sharedSpriteFrameCache() -> ? glVertexAttribPointer(kCCVe...
Vanarajan
1

votes
1

answer
5.1k

Views

How to install Cygwin make package or define the GNUMAKE variable to point in Cocos2d

I am trying apps with cocos2d on running it show the following error.How to solve this. Thank you **** Build of configuration Default for project TestCpp **** bash D:/WorkSpaceOpengl/TestCpp/build_native.sh cygwin warning: MS-DOS style path detected: D:\WorkSpaceOpengl\TestCpp Preferred POSIX equiv...
user2634966
1

votes
2

answer
4k

Views

cocos2d-x beta3 LayerColor doesn't change background color

can't change the color of a background i have this simple class : here is the c++ file : #include "HelloWorldScene.h" USING_NS_CC; HelloWorld::HelloWorld() { ; } Scene* HelloWorld::createScene() { // 'scene' is an autorelease object auto scene = Scene::create(); // 'layer' is an autorelease object...
user63898
1

votes
2

answer
3.8k

Views

Primitives and sprites Z index in Cocos2D-x 3.0 is not consistent?

I have two layers. Each layer has a primitive drawing in it with OpenGL like this: void Layer1::drawPolygon() { glLineWidth(1); DrawPrimitives::setDrawColor4B(255,255,255,255); DrawPrimitives::setPointSize(1); // Anti-Aliased glEnable(GL_LINE_SMOOTH); // filled poly glLineWidth(1); Point filledVerti...
Narek
1

votes
1

answer
865

Views

CCSprite not acting as Physics body in COCOS2dx?

I have the following function which initialises the scene in cocos2dxand to my knowledge i have done everything right. But my CCSprite is still not acting as a Physics body. It remains stationary in the centre of the screen whereas it should fall down and be affected by gravity. Any help would be ap...
Harsh
1

votes
1

answer
1.3k

Views

How can i find angle between two circle points in cocos2dx

I am working in cocos2dx game developing and working on circle gesture detection . I would like to ask how can I find angle between two points.How can i find angle between two points A and B.my ccTouchesMoved event as follows. void HelloWorld::ccTouchesMoved(CCSet *pTouches, CCEvent *pEvent) { CCLog...
bbm20891
1

votes
3

answer
1.4k

Views

Cocos2d-x 3.0rc not detecting touches

In the new cocos2d-x 3.0rc I wanted to detect touch in a Layer. I have over ridden functions in my class as mentioned below. virtual bool onTouchBegan(CCTouch* touch, CCEvent* event); virtual void onTouchMoved(CCTouch* touch, CCEvent* event); virtual void onTouchEnded(CCTouch* touch, CCEvent* event)...
Geo Paul
1

votes
1

answer
8.6k

Views

Cannot initialize a parameter of type “const unsigned char *” with an rvalue of type 'value_type *' (aka char*)

I get an error "Cannot initialize a parameter of type "const unsigned char *" with an rvalue of type 'value_type ' (aka char)" in the following lines. image->initWithImageData(&(buffer->front()),buffer->size()); buffer is of type std::vector *buffer and the above error in on &(buffer->front() does...
Geo Paul
1

votes
1

answer
2k

Views

cocos2d-x 3.0 rc1, create project on Windows

I've downloaded Cocos2d-x 3.0 rc1 on my Windows machine. I'm trying to figure out how to build and create a new game project. On older versions there was a script. How is it done on Windows with the new version?
user1185305
1

votes
1

answer
1.3k

Views

cocos2d-x and box2d linking error

I have troubles working in cocos2d-x v3. Actually, I want to init box2d world object. I have created my game project properly, as it was given in cocos2d-x manual. Now what's the trouble: b2Vec2 gravity = b2Vec2(0.0f, -10.0f); b2World world(gravity); In this code the second line gives the compiler...
inaumov17
1

votes
1

answer
1.6k

Views

Android In app Billing V3 doesn't work

I'm going to implement the Android In-App Billing V3 using IabHelper (trivialdrivesample). I made the game with cocos2d-x. In the google developer console there are already ten in-app products. They almost work well, But some of the items don't work. There is no shown the In-App bundle activity. I d...
ehdyek
1

votes
1

answer
347

Views

Windows phone 8 port on cocos2d-x

I am facing a problem in porting andoird games to windows phone 8 on cocos2d-x. I have following problem in all of them The BG music continues to play when I press WINDOWS button. It pauses when i press the button but after 5-10 seconds starts to play again Thanks in advance for any assistance. Aqe...
Aqeel Raza
1

votes
2

answer
1.3k

Views

cocos 2d x capture screenshot and display instantly in ios c++

I want to capture the screenshot during game and and to display that captured image on app I am using cocos 2d-x v2.3 c++ version. How it can be possible ? Please help me Thanks
Ahmad dar
1

votes
1

answer
678

Views

Why do I get undefined reference when I place constructor definition in the body but not in the header file?

I'm following the tutorial at http://discuss.cocos2d-x.org/t/cocos3-0-tutorial-game-catchme/14258/9, using exact instructions, ie no package specified to cocos console (tried with package to same effect), and using new->Other->C/C++->Class to create the header and body (instead of 2xnew->files) Keep...
John
1

votes
2

answer
1k

Views

Cannot use custom font in Cocos2d-x project

This code works: auto label = LabelTTF::create(CokeStore::name, "Marker Felt", 170); But none of these work: auto label = LabelTTF::create(CokeStore::name, "Coca Cola ii", 170); auto label = LabelTTF::create(CokeStore::name, "CocaColaii", 170); auto label = LabelTTF::create(CokeStore::name, "cocacol...
Hung Nguyen
1

votes
1

answer
103

Views

Disabling of sprite rotation during motion

I am using cocos2d-x and Box2d, how can I prevent my body from rotating during falling, jumping or moving forward or backward.
Adeel Ishaq
1

votes
1

answer
2.2k

Views

Cocos2d-js: How to exit an application in Android and Ios?

I like to know how to exit an app in a good way in Android and Ios? In the helloworld app of cocos2d-js this code is unfortunately omitted: var closeItem = cc.MenuItemImage.create( res.CloseNormal_png, res.CloseSelected_png, function () { cc.log("Menu is clicked!"); }, this); What can be there inste...
Michael
1

votes
2

answer
4.3k

Views

Move progress bar from left to right in cocos2d-x 3.2

I am using the following code to make a progress bar in cocos2d-x 3.2. Sprite *fuelBarBorder; fuelBarBorder = CCSprite::create("ui_kbg.png"); fuelBarBorder->setPosition(_visibleSize.width/2,_visibleSize.height/2); this->addChild(fuelBarBorder, 1); CCProgressTimer *fuelBar; fuelBar = CCProgressTimer:...
Bilal Haider
1

votes
1

answer
1.4k

Views

Cocos2d-x crash: signal 11 (SIGSEGV), code 1 (SEGV_MAPERR) - Unable to open unknown symbol file

I've tried lots of different answers found here at SO but none are directly related with this "unknown symbol file". This is my crash dump: ********** Crash dump: ********** Build fingerprint: 'samsung/ks01ltexx/ks01lte:4.4.2/KOT49H/I9506XXUCNG3:user/release-keys' pid: 22578, tid: 22596, name: Threa...
Alejandro Colorado
1

votes
2

answer
887

Views

Cocos2d-js: some demos don't run on Genymotion

I compiled the Cocos2d-js 'Hello World'-project for Android and try to run it on Genymotion (Android emulator on x86). I already tried adding : APP_ABI := armeabi armeabi-v7a x86 to Application.mk , which makes the apk 3 times bigger, but when I run the app in Genymotion it immediately says "HelloWo...
Dylan
1

votes
3

answer
2.9k

Views

Collision Detection not working in cocos2dx v3 using Physics

I want to collide 2 sprites using Physics Engine. But my contact listener is not responding. and no warning/error on log or runtime. So here is what i did : Declaration 1)cocos2d::PhysicsWorld* m_world; 2)void setPhyWorld(cocos2d::PhysicsWorld* world){m_world = world;} 3)bool onContactBegin(cocos2d:...
Zohaib
1

votes
2

answer
786

Views

Building cocos2dx project in android

x 2.6 programming and I was trying my hands on with hello world project and while running the ./build_native I am getting the following error and there is not much help on this error on the Internet. Android NDK: NDK Application 'local' targets unknown ABI(s): armeabi Android NDK: Please fix the...
jitenagarwal19
1

votes
1

answer
755

Views

Cocos2d-x: How can I draw a resizing rectangle?

I'm working on a project with Cocos2d-x 3.4 (wonderful framework BTW :) ). I was wondering how I can draw a simple translucence selection, the same selection you can see on Windows ? http://cdn.maximumpcguides.com/windows-7/wp-content/uploads/2010/11/use-translucent-select-rectangle-2.png I tried to...
user2330043
1

votes
1

answer
1.2k

Views

fontconfig/fontconfig.h not found in Codeblocks

I am trying to build Cocos2d-x project in Codeblocks IDE in Ubuntu 14. I got fontconfig/fontconfig.h not found error during compiling. I'm stuck here. How can I solve this?
charlotte
1

votes
2

answer
478

Views

Using arc4random_uniform with cocos2d-x

I was happy using arc4random_uniform since iOS, and also for iOS targets of cocos2d-x. Turns out it doesn't work for Android. The error: error: 'arc4random_uniform' was not declared in this scope How can I get around this? Worst case, at compile time I'd check if arc4random_uniform() exists, and if...
Jonny
1

votes
1

answer
2.2k

Views

How to draw a segment of a circle in Cocos2d-x?

Context I try to draw pie chart for statistic in my game. I'm using Cocos2d-x ver.3.8.1. Size of the game is important, so I won't to use third-party frameworks to create pie charts. Problem I could not find any suitable method in Cocos2d-x for drawing part of the circle. I tried to do I tried to fi...
alc77
1

votes
1

answer
550

Views

Save to Cocos2dx UserDefault from the Cocos2dxActivity.java file?

My problem is rather simple, I can save to the "cocos2d::UserDefault" from iOS by doing this, because the .mm file can execute cpp easily: cocos2d::UserDefault::getInstance()->setStringForKey("notification_payload", payload_string); however on java i can't do this, so i was wondering if there is a s...
Pochi
1

votes
1

answer
968

Views

Cocos2d-x c++ - Wait for action finish before continuing

I'm making a slider puzzle, this function should move a tile and then return back to the main function so that i can continue playing, i also use this function to shuffle the tiles at the beginning of the game but when i call this all the tiles move toghether and go in the wrong spot or off the scre...
Gualtiero
0

votes
1

answer
67

Views

Game Center multiplayer matchmaking issue

I am trying to create a real time multiplayer game using Game Center. For matchmaking, I am using programmatic approach by using the following code: [[GKMatchmaker sharedMatchmaker] findMatchForRequest:request withCompletionHandler:^(GKMatch *match, NSError *error) { if (error) { // Process the erro...
Nimesh Chandramaniya

View additional questions