cocos2d-x-3.0

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

萝らか妹 提交于 2019-12-01 13:18:17
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 filledVertices[] = { Point(10,120), Point(50,120), Point(50,170), Point(25,200), Point(10,170) }; DrawPrimitives::drawSolidPoly(filledVertices, 5, Color4F(0.5f, 0.5f, 1, 1 ) ); } When I addChild these layers to a scene and set Z orders 1 and 2, I see that I can bring one primitive on top of another and vice

cocos2d::Menu click detection is a bit off to bottom left whenever using a custom window size

China☆狼群 提交于 2019-12-01 13:00:23
After weeks of debugging, I struggle to figure out what was going on with cocos2d::Menu. I was surprise that my MenuItemImage was not receiving callbacks when I click on the button. So I click anywhere else out of frustration and boom, as I clicked on the bottom left corner, the callback registers in! Its a bit off towards the bottom-left and wondering what might caused this? I already reproduce the problem using the crappy sample project provided as is and was not able to reproduce this using the default window size. But the problem was now reproducible when I change to a custom size. I also

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

自作多情 提交于 2019-12-01 10:08:35
问题 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 filledVertices[] = { Point(10,120), Point(50,120), Point(50,170), Point(25,200), Point(10,170) }; DrawPrimitives::drawSolidPoly(filledVertices, 5, Color4F(0.5f, 0.5f, 1, 1 ) ); } When I addChild these layers

cocos2d-x-3.0 draw vs onDraw

只愿长相守 提交于 2019-11-30 04:30:12
I'm using cocos2d-x v3.0 and in some test project I'm doing some custom drawing by overriding Node 's draw method, but in the DrawPrimitives example provided they do something like this: void DrawPrimitivesTest::draw() { _customCommand.init(_globalZOrder); _customCommand.func = CC_CALLBACK_0(DrawPrimitivesTest::onDraw, this); Director::getInstance()->getRenderer()->addCommand(&_customCommand); } void DrawPrimitivesTest::onDraw() { // drawing code here, why? } From reading the header and source files it seems like this may be some way of sending render commands straight to the renderer, is that

How to debug cocos2d-x 3 native code on android device

。_饼干妹妹 提交于 2019-11-28 17:40:18
I could not find any cookbook/tutorial how build in debug build a cocos2d-x 3.1 project for Android and how to debug it directly on device. Please help by pointing out steps. What I do and what problems I have: cd proj.android cocos compile -p android -m debug --ndk-mode NDK_DEBUG=1 (to build with debug info) cocos run -p android -m debug to deploy on device run app on the device cd jni ndk-gdb And I get this error: Nareks-MacBook-Pro:jni Narek$ ndk-gdb jni/Android.mk:67: *** Android NDK: Aborting. . Stop. ERROR: The device does not support the application's targetted CPU ABIs! Device supports