cocos2d-x

Errors after changed OpenGL code from ES 1.0 to ES 2.0

泄露秘密 提交于 2019-12-11 10:58:02
问题 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); glDrawElements(GL_TRIANGLES, (GLsizei) n*6, GL_UNSIGNED_SHORT, m_pIndices); glFrontFace(GL_CW); glDisable(GL_TEXTURE_2D); glDisableClientState(GL_TEXTURE_COORD_ARRAY); glColor4ub(255-(m

CCSequence not working when defined separately

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-11 10:44:04
问题 In cocos2d-x, I have encountered the following problem when trying to define a CCSequence separately, i.e. not within runAction. This works: sprWheel1->runAction( CCSequence::actions( CCDelayTime::actionWithDuration( fDelayTime ), CCEaseExponentialOut::actionWithAction( CCRotateBy::actionWithDuration( fMoveTime, fAngle ) ), NULL ) ); sprWheel2->runAction( CCSequence::actions( CCDelayTime::actionWithDuration( fDelayTime ), CCEaseExponentialOut::actionWithAction( CCRotateBy::actionWithDuration(

Move AdView to bottom, Cocos2dx Activity

巧了我就是萌 提交于 2019-12-11 10:08:11
问题 Help me please to move ads to bottom of the screen Cocos2dxActivity.this.adView = new AdView(Cocos2dxActivity.this, AdSize.SMART_BANNER, mediationId()); @SuppressWarnings("deprecation") ViewGroup.LayoutParams ad_layout_params = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT); Cocos2dxActivity.this.adView.setLayoutParams(ad_layout_params); AdRequest adRequest = new AdRequest(); 回答1: Note : this is in regard to cocos2d-x 3.1.1, though earlier

cocos 2dx getPosition() , always returns initial position instead of current position

泪湿孤枕 提交于 2019-12-11 08:09:15
问题 I have a sprite with having an action through which, it moves towards right side. CCSprite *spaceShip1=CCSprite::create("ufo_1.png"); spaceShip1->setPosition(ccp(visibleSize.width/8,visibleSize.height/2)); this->addChild(spaceShip1, 3); CCMoveBy* moveleft1 = CCMoveBy::create(3, ccp(visibleSize.width, 0)); spaceShip1->runAction(moveleft1); I want to get the current visual position of sprite, as it is moving due to runAction, it should return its updated position. I am using: spaceShip1-

Getting Shared Preferences while Migrating Project from Cocos2dX to Unity Android

陌路散爱 提交于 2019-12-11 07:36:37
问题 I had to port my game from Cocos2dX to Unity for various reasons. I have now ported the project successfully but to launch it I have to make a mechanism to get old user data and store it in new structure, like number of levels locked, high score of users etc. While searching I came to know that COCOS2dX stored data on user's device on following path system/data/data/mygamepackage/shared_prefs/Cocos2dxPrefsFile.xml Is there anyway to get data from above mentioned path? The above path should be

Android Could not find class 'android.app.job.JobScheduler'

偶尔善良 提交于 2019-12-11 06:01:54
问题 I'm keep getting this error while build apk file with option minifyEnabled true . Application build process and installation been success but failed to launch with this error. I have tired to find the the class library. I'm not much familiar with Android app development, please help me with this, Error stack-trace 05-11 11:44:09.307 10196-10196/? E/cutils: to chown(/mnt/shell/emulated/0, 0, 0) 05-11 11:44:09.307 10196-10196/? E/cutils: to chown(/mnt/shell/emulated/obb, 0, 0) 05-11 11:44:09

Cocos2d-x and Marmalade - Troubles with CCCallFuncO

好久不见. 提交于 2019-12-11 04:19:50
问题 I have a working Cocos2d-x project, developed in XCode and based on the version cocos2d-1.0.1-x-0.13.0-beta Now I have to make it work with Marmalade (using VS Express on a Windows pc), and I'm completely new to it. I managed to set up the project and the source code compiles just fine, but when I launch the project I get a cryptic exception when a CCCallFuncO is invocated: DEFAULT: s3eDeviceHandleException: 1 0x00000000 0x00000000 Memory exception (11) attempting to access: 00000000 S3E

OpenGl code is not working for cocos2dx- 3.0 with VS2013 CPP

僤鯓⒐⒋嵵緔 提交于 2019-12-11 03:38:50
问题 want to create a textuered map but it seems that this code is not working. I think openGL portion is not working. may i have missed something , i am trying to make the Tiny wing like map and going through the tutorial : http://www.raywenderlich.com/33266/how-to-create-dynamic-textures-with-ccrendertexture-in-cocos2d-2-x. following code suppose to give output of striped background check the link please. RenderTexture* rt = RenderTexture::create(textureWidth, textureHeight); rt->beginWithClear

cocos2d-x: loading sprite from another thread not possible, any pattern?

浪尽此生 提交于 2019-12-11 02:55:44
问题 Facts of my program Cocos2d-x main loop runs in its own thread. Let's call it cocos2d-x-thread . I have a task_scheduler that runs in its own thread, in which you can submit lightweight tasks. Let's call it task_scheduler-thread . Every x milliseconds, a callback is emitted from the task_scheduler thread. Let's call it task_scheduler-tick-callback . What I want to do I want to load a sprite when task_scheduler-tick-callback is emitted, but I cannot do it from that thread, so I will have to

Weird y-position offset using custom frag shader (Cocos2d-x)

假如想象 提交于 2019-12-11 01:17:07
问题 I'm trying to mask a sprite so I wrote a simple fragment shader that renders only the pixels that are not hidden under another texture (the mask). The problem is that it seems my texture has its y-coordinate offset after passing through the shader. This is the init method of the sprite (GroundZone) I want to mask: bool GroundZone::initWithSize(Size size) { // [...] // Setup the mask of the sprite m_mask = RenderTexture::create(textureWidth, textureHeight); m_mask->retain(); m_mask-