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

Minimum Android Version for cocos2dx 3.13.1

$
0
0

@jarsj wrote:

I am using cocos2dx 3.13.1 but when I do "cocos compile" It prints the following

running: '/Users/harsh/adt/sdk/tools/android update project -t android-10 -p /Users/harsh/crispy/casino/proj.android-studio/app'

This seems to indicate that it's trying to support as low as android-10. I remember reading it somewhere that cocos2dx 3.13 only supports android-15 and greater. minSDKVersion in app/build.gradle is 15. So I am not sure if this is ok or there is some other config that I got messed up.

Posts: 2

Participants: 2

Read full topic


Cocos2d-x Trello Roadmap

Can't asign shader to DrawNode

$
0
0

@owlet wrote:

Hi, I'm trying to asign custom shaders to DrawNode to be able to aply some effects onto custom drawings.

My cpp code is :

class MyDrawNode : public DrawNode {

public:
~MyDrawNode() {

}


static MyDrawNode * create() {
	MyDrawNode * ret = new (std::nothrow) MyDrawNode ();
	if (ret && ret->init()) {
		
		ret->autorelease();
		auto glp = GLProgram::createWithFilenames("shaders/ccShader_PositionColorLengthTexture.vert", "shaders/ccShader_PositionColorLengthTexture.frag");
		glp->retain();
		glp->bindAttribLocation(GLProgram::ATTRIBUTE_NAME_POSITION, GLProgram::VERTEX_ATTRIB_POSITION);
		glp->bindAttribLocation(GLProgram::ATTRIBUTE_NAME_COLOR, GLProgram::VERTEX_ATTRIB_COLOR);
		glp->bindAttribLocation(GLProgram::ATTRIBUTE_NAME_TEX_COORD, GLProgram::VERTEX_ATTRIB_TEX_COORDS);
		glp->link();
		CHECK_GL_ERROR_DEBUG();
		glp->updateUniforms();
		CHECK_GL_ERROR_DEBUG();

		GLProgramState* state = GLProgramState::getOrCreateWithGLProgram(glp);
		ret->setGLProgramState(state);
		ret->setShaderProgram(glp);
		glp->use();

	} else {
		CC_SAFE_DELETE(ret);
	}

	return ret;
}
};

I copy default ccShader_PositionColorLengthTexture.vert and shaders/ccShader_PositionColorLengthTexture.frag from cocos folder (I'm using cocos2dx 3.13 if its important) and change only I line in fragment shader :

gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0);

So I assume that after that line in fragment shader all my drawings call will be drawn in Red color.
And if I set shaders to Sprite or Texture2D instances via the same code, I've got completely Red textures and sprites. So I have a question - How I can set custom shader into a drawing node ?

Posts: 1

Participants: 1

Read full topic

Physics Particles?

$
0
0

@catch_up wrote:

How to implement physics based particles. We've particles in cocos2d-x but how to add physics body to it so that they deflect on touch the physics surface.
Is it possible doing it through particles or other implementation is needed. If so then how?

Example:
1) Check video https://www.youtube.com/watch?v=JbcHjMxSESc
Here when the player-ball touches the wrong surface, it breaks into particles(physics based particles).
How to implement that?

2) Also check,


How they break the green line when the ball touches it.

Posts: 13

Participants: 4

Read full topic

Error trying to run/compile Android version of my game,

$
0
0

@danielsega wrote:

I've been trying to compile my game to android, but every time I try I keep getting this error bellow. Based on the message bellow, it seems like there is some path concatenation error, but I don't know where to go to change it.

c:\Library\cocos2dx\MyGame>cocos run -p android
Building mode: debug
Using Eclipse project : c:\Library\cocos2dx\MyGame\proj.android
Android platform not specified, searching a default one...
running: '"C:\Android\sdk\tools\android" update project -t android-17 -p c:\Library\cocos2dx\MyGame\proj.android'

Updated project.properties
Updated local.properties
Updated file c:\Library\cocos2dx\MyGame\proj.android\proguard-project.txt
It seems that there are sub-projects. If you want to update them
please use the --subprojects parameter.
Android platform not specified, searching a default one...
running: '"C:\Android\sdk\tools\android" update lib-project -p c:\Library\cocos2dx\MyGame\cocos2d\cocos\platform\android\java -t android-17'

Updated project.properties
Updated local.properties
Updated file c:\Library\cocos2dx\MyGame\cocos2d\cocos\platform\android\java\proguard-project.txt
Android platform not specified, searching a default one...
running: '"C:\Android\sdk\tools\android" update lib-project -p c:\Library\cocos2dx\MyGame\cocos2d\cocos\platform\android\java\libs\facebook_lib -t android-22'

Updated project.properties
Updated local.properties
Updated file c:\Library\cocos2dx\MyGame\cocos2d\cocos\platform\android\java\libs\facebook_lib\proguard-project.txt
Building native...
NDK build mode: debug
running: '"C:\Android\ndk\ndk-build" -C c:\Library\cocos2dx\MyGame\proj.android -j8 NDK_MODULE_PATH=c:\Library\cocos2dx\MyGame\proj.android\../cocos2d;c:\Library\cocos2dx\MyGame\proj.android\../cocos2d/cocos;c:\Library\cocos2dx\MyGame\proj.android\../cocos2d/external NDK_TOOLCHAIN_VERSION=4.9 NDK_DEBUG=1'

The system cannot find the path specified.
Error running command, return code: 1.

Posts: 3

Participants: 2

Read full topic

Win10 uwp social sharing

$
0
0

@katieJ wrote:

Hi,

We are at the point where we want to get social sharing working on a cocos2dx c++ project for Windows 10 UWP. I know sdkbox does not support windows. The app required Facebook and twitter sharing along with taking a screen shot. I have asked on UpWork and other places but people don't seem to understand what we need. Can anyone help?

Kind Regards.
Katie

Posts: 1

Participants: 1

Read full topic

Cocos2D-JS(Cocos2d-html5) - UI

$
0
0

@Edisoni wrote:

Will be updated version cocos2d-html5, because the UI there is old and in relatively unoptimized of which is used in the Cocos Creator.
Is it possible to use the engine that is used in Cocos Editor?

Posts: 1

Participants: 1

Read full topic

Cocos2d: warning: Uniform not found: u_color

$
0
0

@steph wrote:

Playing with shaders, in cocos 3.13.1 JS, i see millions of that lines in console, regardless of the platform (osx,android and ios).

cocos2d: warning: Uniform not found: u_color

Can i get rid of this somehow?

what i tired so far:
shader.setUniformFloat("u_color", ....)

or in vertex shader:
uniform float u_color;

nothing seems to work, somehow i am afraid that this logging would cost performance, or that that what leads to this logging could be avoided, to save cycles.

Any ideas? Thank you in advance,
steff

Posts: 1

Participants: 1

Read full topic


Cocos Creator v1.3.2 for Windows Might Have a Trojan?

$
0
0

@staras wrote:

I downloaded version 1.3.2 of Cocos Creator from the download site and Windows Defender flagged the file C:\CocosCreator\resources\utils\api\creator.d.ts to send for analysis. I sent it to Microsoft and it reported that it contains Peals.A!cl malware with a severe threat (https://www.microsoft.com/security/portal/threat/encyclopedia/entry.aspx?name=Trojan%3aWin32%2fPeals.A!cl&threatid=2147690472&enterprise=0)

Can anyone else confirm this?

Posts: 4

Participants: 2

Read full topic

Cocos with firebase example

Technique for animation and tool?

$
0
0

@catch_up wrote:

Hey guys,

What technique do you use for 2D animation : (frame animation / spine-bone animation) ?

If you use spine animation, can you please tell which tool do you use or some tool which is free to use and is is compatible with cocos2d-x ? I know this tool http://esotericsoftware.com/ but it's too much costly for me.

One other tool I know is Spriter. I've googled also but I just wanted to ask you opinion also. I've interest in learning and use cool simple animation for my game.

Thanks :slight_smile:

Posts: 3

Participants: 2

Read full topic

SQLite Android issue

$
0
0

@ChrisS91 wrote:

Hi,
Im trying to include an SQL database in my project,
- I have downloaded and included sqlite.c and .h into my project in Xcode - This works fine on ios
- On Android my .mk file looks like this

LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
$(call import-add-path,$(LOCAL_PATH)/../../../../../cocos2d)
$(call import-add-path,$(LOCAL_PATH)/../../../../../cocos2d/external)
$(call import-add-path,$(LOCAL_PATH)/../../../../../cocos2d/cocos)
$(call import-add-path,$(LOCAL_PATH)/../../../../../cocos2d/cocos/audio/include)
LOCAL_MODULE := MyGame_shared
LOCAL_MODULE_FILENAME := libMyGame
LOCAL_SRC_FILES := hellocpp/main.cpp \
                   ../../../Classes/AppDelegate.cpp \
                   ../../../Classes/HelloWorldScene.cpp \
                   ../../../Classes/sqlite3.c \
LOCAL_C_INCLUDES := $(LOCAL_PATH)/../../../Classes
# _COCOS_HEADER_ANDROID_BEGIN
# _COCOS_HEADER_ANDROID_END
LOCAL_STATIC_LIBRARIES := cocos2dx_static
# _COCOS_LIB_ANDROID_BEGIN
# _COCOS_LIB_ANDROID_END
include $(BUILD_SHARED_LIBRARY)
$(call import-module,.)
# _COCOS_LIB_IMPORT_ANDROID_BEGIN
# _COCOS_LIB_IMPORT_ANDROID_END

But when I try to compile my project on android I'm getting tons of errors for example the first few errors

jni/../../../Classes/sqlite3.c:31470:42: error: 'mmap' undeclared here (not in a function)
   { "mmap",         (sqlite3_syscall_ptr)mmap,            0 },
                                          ^
jni/../../../Classes/sqlite3.c:31477:42: error: 'munmap' undeclared here (not in a function)
   { "munmap",       (sqlite3_syscall_ptr)munmap,          0 },
                                          ^
jni/../../../Classes/sqlite3.c:31484:42: error: 'mremap' undeclared here (not in a function)
   { "mremap",       (sqlite3_syscall_ptr)mremap,          0 },
                                          ^

There are hundreds of these errors after and I'm wondering if anybody knows what I am doing wrong?
Or a suggestion to help?
Thanks

Posts: 9

Participants: 2

Read full topic

Build error for android studio

$
0
0

@tonyw wrote:

hi,

after doing this -

cocos compile -p android --android-studio --ap android-24

I get this! Anyone understand it? I get the same with a brand new clean project. Latest cocos2d-x-3.13.1

Evaluating project ':libcocos2dx' using build file '/Users/tonywarriner/code/sticky_cocos/cocos2d/cocos/platform/android/libcocos2dx/build.gradle'.
Compiling build file '/Users/tonywarriner/code/sticky_cocos/cocos2d/cocos/platform/android/libcocos2dx/build.gradle' using BuildScriptTransformer.

FAILURE: Build failed with an exception.

*** Where:**
Build file '/Users/tonywarriner/code/sticky_cocos/cocos2d/cocos/platform/android/libcocos2dx/build.gradle' line: 1

*** What went wrong:**
A problem occurred evaluating project ':libcocos2dx'.
> java.lang.UnsupportedClassVersionError: com/android/build/gradle/LibraryPlugin : Unsupported major.minor version 52.0

*** Try:**
Run with --stacktrace option to get the stack trace. Run with --debug option to get more log output.

BUILD FAILED

Posts: 1

Participants: 1

Read full topic

experimental::TMXTiledMap maps bigger than 128x128 with 32-bit indices

$
0
0

@intotherude wrote:

I searched a bit and found that there is a limitation on the size of tilemaps around 128x128 because of an openGL limitation on the amount of vertices that can be rendered in one call.

I am using the experimental::TMXTiledMap, which only renders the tiles visible in the viewport (automatic culling). It does so by calculating which tiles are visible and creating an index buffer with only the visible vertices. This index buffer is a vector of GLushort (16bit).

I changed the source code of experimental::TMXLayer like this:

CCFastTMXLayer.h
std::vector<GLuint> _indices; instead of std::vector<GLushort> _indices;

CCFastTMXLayer.cpp in the method updateIndexBuffer()
_indexBuffer = IndexBuffer::create(IndexBuffer::IndexType::INDEX_TYPE_SHORT_32, (int)_indices.size());
instead of
_indexBuffer = IndexBuffer::create(IndexBuffer::IndexType::INDEX_TYPE_SHORT_16, (int)_indices.size());

After this change, cocos could render maps bigger than 128x128 on win32.

My question: why is this limit enforced hard coded? Because of multi-platform? I googled a bit, and found out it should work on iOS as well (not tested):

on which someone answers:

This answer is incorrect, GL_UNSIGNED_INT is supported for glDrawElements if GL_OES_element_index_uint is implemented (which it is in iOS, according to OpenGLES/ES2/glext.h).

Posts: 4

Participants: 2

Read full topic

When Release 3.14


Cannot find android/cpufeatures/prebuilt-mk OR undefined reference to atof/rand

$
0
0

@MastAKK wrote:

I was trying to build my project with pre-built libs.
So, I did cocos gen-libs, everything was ok. But then I created new project with -t binary.
Now I have one of 2 problems:

With

$(call import-module, android/cpufeatures/prebuilt-mk)

in cocos\prebuilt-mk\Android.mk I got following error message:

Android NDK: WARNING: APP_PLATFORM android-19 is larger than android:minSdkVersion 9 in ./AndroidManifest.xml
Android NDK: D:\libs/cocos2d-x-3.13.1/cocos/./prebuilt-mk/Android.mk: Cannot find module with tag 'android/cpufeatures/prebuilt-mk' in import path
Android NDK: Are you sure your NDK_MODULE_PATH variable is properly defined ?

I've tried to fix this by replacing

$(call import-module, android/cpufeatures/prebuilt-mk)

with

$(call import-module, android/cpufeatures)

And now I have following errors:

D:/libs/cocos2d-x-3.13.1/tools/simulator/frameworks/runtime-src/proj.android/../../../../../cocos//editor-support/cocostudio/CCSSceneReader.cpp:550: error: undefined reference to 'atof'
D:/libs/cocos2d-x-3.13.1/tools/simulator/frameworks/runtime-src/proj.android/../../../../../cocos//editor-support/cocostudio/WidgetReader/NodeReader/NodeReader.cpp:261: error: undefined reference to 'atof'
D:/libs/cocos2d-x-3.13.1/tools/simulator/frameworks/runtime-src/proj.android/../../../../../cocos//editor-support/cocostudio/WidgetReader/NodeReader/NodeReader.cpp:265: error: undefined reference to 'atof'
D:/libs/cocos2d-x-3.13.1/tools/simulator/frameworks/runtime-src/proj.android/../../../../../cocos//editor-support/cocostudio/WidgetReader/NodeReader/NodeReader.cpp:144: error: undefined reference to 'atof'
D:/libs/cocos2d-x-3.13.1/tools/simulator/frameworks/runtime-src/proj.android/../../../../../cocos//./base/ccRandom.h:117: error: undefined reference to 'rand'
D:/libs/cocos2d-x-3.13.1/tools/simulator/frameworks/runtime-src/proj.android/../../../../../cocos//./base/ccRandom.h:117: error: undefined reference to 'rand'
D:/libs/cocos2d-x-3.13.1/tools/simulator/frameworks/runtime-src/proj.android/../../../../../cocos//./base/ccRandom.h:103: error: undefined reference to 'rand'
D:/libs/cocos2d-x-3.13.1/tools/simulator/frameworks/runtime-src/proj.android/../../../../../cocos//./base/ccRandom.h:103: error: undefined reference to 'rand'
etc.

I didn't found solution for this neither in google nor in this forum. So whar I did wrong? Or what should I do to fix this?

I use android-ndk-r12b, abi android-19 and Cocos 3.13.1.

Posts: 4

Participants: 3

Read full topic

Json Error for AddMember method

$
0
0

@sunil9038 wrote:

My code in V 3.3
Document document;
document.SetObject();
rapidjson::Document::AllocatorType& allocator = document.GetAllocator();
document.AddMember("usrId",usrId.c_str(), allocator);
StringBuffer strbuf;
Writer writer(strbuf);
document.Accept(writer);

this code is working fine in V 3.3

Now i am porting it to 3.10 but it's Giving error:-
no matching function for call to 'rapidjson::GenericDocument >::AddMember(const char [6], const char*, rapidjson::GenericDocument >::AllocatorType&)'
document.AddMember("usrId",usrId.c_str(), allocator);

Posts: 1

Participants: 1

Read full topic

Create 3D particle with particle (.pu)

[solved]Bug at compile time .How can i fix it?

$
0
0

@sunil9038 wrote:

i am using Eclipse.

UNEXPECTED TOP-LEVEL EXCEPTION:
[dx] com.android.dex.DexException: Multiple dex files define Lcom/loopj/android/http/AsyncHttpClient$1;
[dx] at com.android.dx.merge.DexMerger.readSortableTypes(DexMerger.java:591)
[dx] at com.android.dx.merge.DexMerger.getSortedTypes(DexMerger.java:546)
[dx] at com.android.dx.merge.DexMerger.mergeClassDefs(DexMerger.java:528)
[dx] at com.android.dx.merge.DexMerger.mergeDexes(DexMerger.java:164)
[dx] at com.android.dx.merge.DexMerger.merge(DexMerger.java:188)
[dx] at com.android.dx.command.dexer.Main.mergeLibraryDexBuffers(Main.java:504)
[dx] at com.android.dx.command.dexer.Main.runMonoDex(Main.java:334)
[dx] at com.android.dx.command.dexer.Main.run(Main.java:277)
[dx] at com.android.dx.command.dexer.Main.main(Main.java:245)
[dx] at com.android.dx.command.Main.main(Main.java:106)

Posts: 3

Participants: 2

Read full topic

Handling Memory

$
0
0

@sheshmoshen wrote:

Im really worried about handling memory.
I'm thinking to call removeAllChildrenWithCleanup(true) and release() on all Nodes that my Class may encapsulate.
But how will the scene's destructor get called? and how will all the children of that scene's destructors be called when I switch to another scene?

Posts: 6

Participants: 3

Read full topic

Viewing all 2748 articles
Browse latest View live