Quantcast
Channel: cocos2d-x - Cocos Forums
Viewing all 2747 articles
Browse latest View live

Static assert while addChild to camera..

$
0
0

@digimikeh wrote:

Hi…

when i attach a label object to the camera, static assert appear… clipPos.w != 0.0

this->getDefaultCamera()->addChild(myLabelObj);

this does not happens when i attach a menu item… why

Thanks.

Posts: 2

Participants: 2

Read full topic


Crash issue android

$
0
0

@shaktiraj wrote:

cocos2dx version - 3.17.2
NDK Resolution Outcome: Project settings: Gradle model version=5.1.1, NDK version=19.2.5345600

Hello @Big_Bear @drelaptop @zhangxm @slackmoehrle

i got strange crash in my google play console can you help me for resolve it ?
thanks in advance.

Crash log(i have changed package name)


pid: 0, tid: 0 >>> com.company.gamename <<<

backtrace:
#00 pc 000000000004b024 /system/lib/libc.so (tgkill+12)
#01 pc 00000000000487c3 /system/lib/libc.so (pthread_kill+34)
#02 pc 000000000001d775 /system/lib/libc.so (raise+10)
#03 pc 00000000000192b1 /system/lib/libc.so (__libc_android_abort+34)
#04 pc 0000000000017024 /system/lib/libc.so (abort+4)
#05 pc 000000000001b76f /system/lib/libc.so (__libc_fatal+22)
#06 pc 00000000000194ab /system/lib/libc.so (__assert2+18)
#07 pc 00000000008e8c9d /data/app/com.company.gamename-1/lib/arm/libMyGame.so
#08 pc 00000000008e8da5 /data/app/com.company.gamename-1/lib/arm/libMyGame.so
#09 pc 00000000008e72fd /data/app/com.company.gamename-1/lib/arm/libMyGame.so
#10 pc 00000000008e6c93 /data/app/com.company.gamename-1/lib/arm/libMyGame.so
#11 pc 00000000008e6c5b /data/app/com.company.gamename-1/lib/arm/libMyGame.so (__cxa_throw+74)
#12 pc 00000000008b33ed /data/app/com.company.gamename-1/lib/arm/libMyGame.so (_Znwj+56)
#13 pc 0000000000572ce0 /data/app/com.company.gamename-1/lib/arm/libMyGame.so (_ZNSt6__ndk16vectorIN7cocos2d11V3F_C4B_T2FENS_9allocatorIS2_EEE8__appendEj+148)
#14 pc 00000000005727ec /data/app/com.company.gamename-1/lib/arm/libMyGame.so (_ZN5spine13SkeletonBatch16allocateVerticesEj+92)
#15 pc 0000000000562458 /data/app/com.company.gamename-1/lib/arm/libMyGame.so (_ZN5spine16SkeletonRenderer4drawEPN7cocos2d8RendererERKNS1_4Mat4Ej+624)
#16 pc 0000000000613ea0 /data/app/com.company.gamename-1/lib/arm/libMyGame.so (_ZN7cocos2d4Node5visitEPNS_8RendererERKNS_4Mat4Ej+316)
#17 pc 0000000000613f00 /data/app/com.company.gamename-1/lib/arm/libMyGame.so (_ZN7cocos2d4Node5visitEPNS_8RendererERKNS_4Mat4Ej+412)
#18 pc 0000000000613f00 /data/app/com.company.gamename-1/lib/arm/libMyGame.so (_ZN7cocos2d4Node5visitEPNS_8RendererERKNS_4Mat4Ej+412)
#19 pc 0000000000613f00 /data/app/com.company.gamename-1/lib/arm/libMyGame.so (_ZN7cocos2d4Node5visitEPNS_8RendererERKNS_4Mat4Ej+412)
#20 pc 000000000063232c /data/app/com.company.gamename-1/lib/arm/libMyGame.so (_ZN7cocos2d5Scene6renderEPNS_8RendererEPKNS_4Mat4ES5_j+460)
#21 pc 0000000000632154 /data/app/com.company.gamename-1/lib/arm/libMyGame.so (ZN7cocos2d5Scene6renderEPNS_8RendererERKNS_4Mat4EPS4+28)
#22 pc 00000000006983d8 /data/app/com.company.gamename-1/lib/arm/libMyGame.so (_ZN7cocos2d8Director9drawSceneEv+496)
#23 pc 000000000069b3e0 /data/app/com.company.gamename-1/lib/arm/libMyGame.so (_ZN7cocos2d8Director8mainLoopEv+128)
#24 pc 0000000000518f8d /data/app/com.company.gamename-1/oat/arm/base.odex

Posts: 1

Participants: 1

Read full topic

OpenGL error in Xcode 11 and ios 13

$
0
0

@chiragkevadiya wrote:

I am getting this error to run game

xcode version 11
and my iphone version is 13.

this continuously displays this error in the log but not run game

OpenGL error 0x0506 in /Users/milanitaliya/MilanData/projects/clientWork/KidsEducationalGame_Andy/cocos2d/cocos/renderer/CCFrameBuffer.cpp applyFBO 449

FrameBuffer Status Error 36054

OpenGL error 0x0506 in /Users/milanitaliya/MilanData/projects/clientWork/KidsEducationalGame_Andy/cocos2d/cocos/renderer/CCRenderer.cpp saveRenderState 159

OpenGL error 0x0506 in /Users/milanitaliya/MilanData/projects/clientWork/KidsEducationalGame_Andy/cocos2d/cocos/renderer/CCRenderer.cpp restoreRenderState 189

OpenGL error 0x0506 in -[CCEAGLView swapBuffers] 334

OpenGL error 0x0506 in /Users/milanitaliya/MilanData/projects/clientWork/KidsEducationalGame_Andy/cocos2d/cocos/renderer/CCFrameBuffer.cpp applyFBO 449

FrameBuffer Status Error 36054

OpenGL error 0x0506 in /Users/milanitaliya/MilanData/projects/clientWork/KidsEducationalGame_Andy/cocos2d/cocos/renderer/CCRenderer.cpp saveRenderState 159

OpenGL error 0x0506 in /Users/milanitaliya/MilanData/projects/clientWork/KidsEducationalGame_Andy/cocos2d/cocos/renderer/CCRenderer.cpp restoreRenderState 189

Posts: 3

Participants: 2

Read full topic

EventDispatcher has no function

$
0
0

@lional2410 wrote:

When I use the EventDispatcher in a few new cpp files, it says that class EventDispatcher doesn’t have function addEventListenerWithSceneGraphPriority. I tried to use other functions too but none works. The ide, however, can trace every function contained in the class. Here is some images

Posts: 7

Participants: 2

Read full topic

How to use V2F_C4F_T2F in a Sprite?

$
0
0

@MatX wrote:

How can I use V2F_C4F_T2F in a Sprite so that I can specify the position, the color and the texture coordinates within a texture bound to a Sprite at the same time? Sort of like here:

But I want to be able to manipulate even the texture coordinates. Triangles made up of V2F_C4F_T2F objects seem to be a perfect fit for this - only I don’t know how to achieve this…

Posts: 1

Participants: 1

Read full topic

Cross Platform Cocos2d-x Lite Version Framework?

$
0
0

@MohammedHatim wrote:

Hi,
I am using cocos2d-x-v3.17.1 framework to create 2d cross platform games in JS, Just wanted to now is their any Lite version available that supports cross platform games, because most of the modules like 3d, Physics3d, Chipmunk, navmesh etc … am not using in my game…

Attaching a screenshot of apk-src-directory for reference.

Thanks for any response in advance.

Posts: 2

Participants: 2

Read full topic

About graphics and sprites in general

$
0
0

@digimikeh wrote:

Hi!..
Yesterday I was studying Donkey Kong Country from SNES where Super Stamper Brothers did a great job taking real life object pictures and then passed them into their framework, I´m trying to do something similar, but I´m not pretty sure the way I need to follow to generate that fancy backgrounds… Since a platform game is a very long stripe of way, I was wondering how good idea (to performance) is to generate a “8192w (or even more) x 512h” png image rather than tiling it like most developers do.

has anyone tried this long png stripe ?
Greetings

Posts: 5

Participants: 2

Read full topic

Avoid notch on iPhone

$
0
0

@Adamos2 wrote:

I made a C++ game using Cocos 3.17.2.

On Android, I just have to change one string in default template:
lp.layoutInDisplayCutoutMode = LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_NEVER;
Then I can work with whole screen rectangle but notch area.

How to get the same on iOS?
LaunchScreen.storyboard doesn’t work for me or I can’t cook it right.
getSafeAreaRect gives me strange rectangle with margins on three sides of the screen. Fitting all the interface inside it lefts a lot of empty space aside.

Is there an easy solution I don’t know?

Posts: 7

Participants: 3

Read full topic


Player object inside the scene

$
0
0

@digimikeh wrote:

Hi!..

I don´t really like to guess to use a blind development way to follow… so i ask you more experienced programmers…

Do you use Composing or Inheritance in your development?..
I have done my first two scenes (Menu and a simple non playable comic view prologue story)…
The third scene is the first gameplay so of course need to create my player.

But a player could be a simple sprite that reacts to input, that does not requires an external custom type, say Player.h, this is the way you follow or do you create your own Player.h class with jump, crouch, run and talk member functions?..

Posts: 3

Participants: 3

Read full topic

Using libuv as UDP server in iOS app

Get Sprite3D Size (width, length, height)

$
0
0

@miftahsyah wrote:

Hi! I want to ask, is it possible to get the size of Sprite3D like length, width and height on cocos2d-x?
Just like when we want to get content size from 2D Sprites, we only need to write sprite-> getContentSize ()
Thank you!

Posts: 1

Participants: 1

Read full topic

Gradle 3.5.0 fails to build cocos2dx

$
0
0

@Guykun wrote:

Re-opening Android Studio: Native build fails after and upgrade because no solution was found and the topic was closed with a ‘temporary solution’ of downgrading.

Upgrading to gradle 3.5.0 (which is desirable in order to specify an ndk version to build against) results in the error

make: *** No rule to make target `cocos2dcpp'.  Stop.

Does anyone have any idea as to why gradle 3.5.0 breaks the current build? (using the steps given at Cocos2d-x Android Studio NDK build C++ DEBUG - WORKS!)

Posts: 2

Participants: 2

Read full topic

SDKBOX Facebook setup link broken

using template to load scenes...

$
0
0

@digimikeh wrote:

Hi!.
Actually i’m trying to implement inheritance for my scenes, this is a template function member i have in my abstract superclass:

protected:
    template <class T>
    inline void load_scene(T scn, cocos2d::Color3B col) {
        T next_scene = scn::create();
        Director::getInstance()->replaceScene(TransitionFade::create(0.5f, next_scene, col));
    }

Each subclass should load another scene using this function, problem is, it won’t to compile.
C2653 error

I’m wondering if i need to cast something?

Posts: 2

Participants: 2

Read full topic

Forward declaration in Cocos?

$
0
0

@digimikeh wrote:

Hi !, i have created a simple struct that manages some functions for all scenes, some parameters are owned by cocos, so i need to forward declare those types.

#ifndef __HELPER_H__
#define __HELPER_H__

#pragma once

struct Color3B;
class Label;

struct helper {

private:
	const float C_LOAD_SCENE_FADE_TIME = 0.5f;

public:
	template <typename T>
	void load_scene(T scn, Color3B col);	
	void write_text_on_label(Label*& et, const char* txt, Color3B col);
	void play_SFX(const char* sfx_file);
	void play_BGM(const char* bgm_file, bool loop = false);

};

#endif //__HELPER_H__

Then i get the error some incompatible declaration errors, suspect i have not forward declared correctly…

Posts: 3

Participants: 2

Read full topic


Default camera resets its position after TransitionFade to other scene

$
0
0

@digimikeh wrote:

Hi mates…

On init, I set default camera position to ZERO so my viewport is correctly aligned with my sprites, until here all is fine…

When i try to load the next scene using TransitionFade, before this opacity effect begins, the camera position resets to its default value (that is not ZERO),

Director::getInstance()->replaceScene(TransitionFade::create(2.f, scen, Color3B::BLACK));

Posts: 6

Participants: 3

Read full topic

Orientation issue with cocos2dx 3.17.2 iOS

$
0
0

@frozax wrote:

I have a game which supports portrait and landscape. I can switch from one and the other without issue when the game is running.
However, on iOS, when the orientation changes while the game is not in the foreground, the orientation is wrong when coming back to the game. The reproduction is as follow:

  • Play the game in landscape
  • Tap home and run the Messages application.
  • While in the Mesages applications, go to portrait mode
  • Go back in the game.
  • Observer the problem.

I debugged a little, and discovered that the difference is that resizeFromLayer is not called (from layoutSubviews) when the issue happens.

Any one got an idea to fix it ?

Posts: 2

Participants: 2

Read full topic

RenderTexture used with PolygonInfo renders incorrectly

$
0
0

@MatX wrote:

I want to use a RenderTexture to render some color gradient triangles (before you recommend DrawNode, no, DrawNode is unfortunately not good enough, because I will want to manipulate the RenderTexture by splitting it up into sub triangles, and maybe use some textures). But the below code in my HelloWorldScene that I wrote doesn’t work as expected:

bool HelloWorld::init()
{
    if ( !Scene::init() )
    {
	  return false;
    }

// creating rendertexture
Size size = Size(100, 100);
auto renderTexture = RenderTexture::create(size.width, size.height, Texture2D::PixelFormat::RGBA8888);

// clearing rendertexture with uniform white color
renderTexture->beginWithClear(Color4F::WHITE.r, Color4F::WHITE.g, Color4F::WHITE.b, Color4F::WHITE.a);
renderTexture->end();

// creating triangles to render
auto triangles = new TrianglesCommand::Triangles();
triangles->indexCount = 3;
triangles->indices = new unsigned short[3]{ 1, 2, 3 };
triangles->vertCount = 3;
auto v1 = V3F_C4B_T2F();
auto v2 = V3F_C4B_T2F();
auto v3 = V3F_C4B_T2F();
v1.vertices = Vec3(0, 0, 0);
v2.vertices = Vec3(100, 0, 0);
v3.vertices = Vec3(100, 100, 0);
v1.colors = Color4B::RED;
v2.colors = Color4B::GREEN;
v3.colors = Color4B::BLUE;
v1.texCoords = Tex2F(0, 0);
v2.texCoords = Tex2F(1, 0);
v3.texCoords = Tex2F(1, 1);
triangles->verts = new V3F_C4B_T2F[3]{ v1, v2, v3 };

auto polygonInfo = renderTexture->getSprite()->getPolygonInfo();
polygonInfo.setTriangles(*triangles);
renderTexture->getSprite()->setPolygonInfo(polygonInfo);
this->addChild(renderTexture);
renderTexture->setPosition(Vec2(200, 200));

return true;
}

This gives me the following output:
rendertexture_weird

The problems are:

  • There is no red in it anywhere, however I explicitely specified it. Instead, the bottom left vertex - which should be red - fades into black. Why?
  • The triangle is boxed in a rectangle that is much bigger than 100×100, however I explicitely specified that it should be 100×100.
  • The triangle should have a right angle and the other sides should be of equal length - see the coordinates. But instead, it’s stretched in a weird way when I set the position of the RenderTexture. It should just translate the whole RenderTexture to the specified point. Why is it stretching it, while leaving the bottom left vertex in the origin?

How can I fix all these issues?

Posts: 1

Participants: 1

Read full topic

32 bit apps on new Mac OS Catalina

$
0
0

@piotrros wrote:

Hello,
a bit more of general question, but it’s related to tools like Cocos Studio, but not only that. Is there any workaround to run 32bit apps on the new Mac OS Catalina?

For now I just don’t update, but I’d have to do it in the future. That’s because Apple won’t support older systems for Xcode forever, it’s just a matter of time. I’d like to switch to Creator, but it’s a big task and I also use tons of tools, which runs perfectly fine, but are 32bit only.

Posts: 5

Participants: 3

Read full topic

cocos creator axios import

$
0
0

@tdf0495 wrote:

hello im korean developer,

i’m using typeScript

i want to import the axios.js

but problem is import axios from 'axios' is not work!

what should i do?

Posts: 1

Participants: 1

Read full topic

Viewing all 2747 articles
Browse latest View live