cocos2d-x

Cocos2d-JS地图性能问题

ぃ、小莉子 提交于 2019-12-04 01:31:22
如图 所示游戏场景,它是我们以往 介绍的实例,在场景中有三个方块精灵( BoxA 、 BoxB 和 BoxC )和背景精灵,这个背景叫做“地图”有点牵强,地图采用了有规律的纹理。 游戏场景 那么我们如何设计这个游戏地图呢?我们可以使用两种方法:采用一张大图片和采用小纹理图片重复贴图。 1 、采用一张大图片 我们在以往中 介绍的实例,采用一张大图片。我们可以让美术设计师帮助我们制作一个屏幕大小的图片,大小 960 x 640 像素 ,如图 所示 。如果是RGBA8888 格式 ,则占用内存大小大约 2400K 字节。 游戏地图 2 、采用小纹理图片重复贴图 采用就是小纹理图片重复贴图,每个小的纹理图片大小是128 x 128 像素 ,如图 所示。如果是 RGBA8888 格式 ,则占用内存大小大约 64K 字节,纹理图片宽高必须是 2的n次幂。 小纹理图片 提示 图片占用内存大小与图片格式有关,图片格式有关主要有:RGBA8888、RGBA4444 和 RGB565等。RGBA8888和RGBA4444 格式一个像素有 4 个(红、绿、蓝、透明度)通道, RGBA8888 一个通道占 8 比特, RGBA4444 一个通道占 4比特,1 字节 = 8 比特 。因此RGBA8888 格式 的计算的公式:长 x 宽 x 4 字节, RGBA4444 格式 的计算的公式:长 x 宽 x

[Android]Couldn't load testcpp: findLibrary ret...

隐身守侯 提交于 2019-12-04 01:23:19
##问题引出 过程 在开发cocos2dx的过程中,发现错误E/AndroidRuntime( 999): java.lang.UnsatisfiedLinkError: Couldn't load testcpp: findLibrary returned null,然后很自然的就百度,Google,看文档,问朋友,最后拖延了8个小时 找到 答案 找到答案之后我恍然大悟,NDK开发是使用ARM的指令集,当然要用ARM的CPU模拟器了,悲剧的是我认为我的电脑的CPU是Intel的,然后傻乎乎认为使用Intel的CPU指令会更快,就用上了Intel的CPU模拟器 解决问题 Android模拟器选项中的 CPU/ABI 选择为ARM,至此问题解决 [注1]此方法并不算是findLibrary returned null的完全解决方案,我只是遇到啥解决啥,往后再遇到相同的问题再续。 来源: oschina 链接: https://my.oschina.net/u/130461/blog/158486

“cannot find module with tag 'CocosDenshion/android' in import path” error in cocos2dx app

不羁岁月 提交于 2019-12-04 00:07:07
I am trying to compile Android native application developed on cocos2d-x. When i Try to debug my application i get the following error. Android NDK: jni/Android.mk: Cannot find module with tag 'CocosDenshion/android' in import path Android NDK: Are you sure your NDK_MODULE_PATH variable is properly defined ? Android NDK: The following directories were searched: I have the following lines in my android.mk file $(Call import-add-path, $(LOCAL_PATH)/../../../CocosDenshion/android) LOCAL_WHOLE_STATIC_LIBRARIES := cocos2dx_static cocosdenshion_static include $(BUILD_SHARED_LIBRARY) $(call import

Android Studio打包cocos creator项目出现java.lang.UnsatisfiedLinkError:SDKWrapper.nativeLoadAllPlugins:()

瘦欲@ 提交于 2019-12-03 22:10:26
最近用 cocos creator 开发一个游戏,用 Android Studio 打包 Apk 时却出现了以下错误: Process: org.cocos2dx.javascript, PID: 24123 java.lang.UnsatisfiedLinkError: Native method not found: org.cocos2dx.javascript.SDKWrapper.nativeLoadAllPlugins:()V at org.cocos2dx.javascript.SDKWrapper.nativeLoadAllPlugins(Native Method) at org.cocos2dx.javascript.SDKWrapper.init(SDKWrapper.java: 36 ) at org.cocos2dx.javascript.AppActivity.onCreate(AppActivity.java: 47 ) 看到这个错误我就懵了,这是个什么鬼?真是一点头绪都没有,然后就是上网各种搜,然后。。。没有一个有用的。。。 最后没办法,只好用最原始的办法,删除项目,然后用cocos creator重新构建一下,然后再用Android Studio打开构建后的项目,这次倒是一切都正常,然而,当我新建一个Activity并将其设置为 启动

syncing multiple audio tracks on android

瘦欲@ 提交于 2019-12-03 21:30:46
问题 I'm trying to create a music based game (similar to "my singing monsters). the idea is that I have a scene where I can place and remove a few different characters from the scene, each character has a unique mp3 file for its singing. I'm building my game with cocos2dx though for sounds I'm using a custom engine which currently uses MediaPlayer API on android. In order to sync all the sounds together I just play them all when the scene is loaded and then just mute and unmute according to which

Camera frame yuv to rgb conversion using GL shader language

a 夏天 提交于 2019-12-03 20:48:38
I am getting the camera frame from the android camera Preview Callback in Byte array and pass it to jni code. As we can't use byte in c++ so i am converting it to the integer array as follows: JNIEXPORT void JNICALL Java_com_omobio_armadillo_Armadillo_onAndroidCameraFrameNative( JNIEnv* env, jobject, jbyteArray data, jint dataLen, jint width, jint height, jint bitsPerComponent) { Armadillo *armadillo = Armadillo::singleton(); jbyte *jArr = env->GetByteArrayElements(data, NULL); int dataChar[dataLen]; for (int i = 0; i < dataLen; i++) { dataChar[i] = (int) jArr[i]; } Then I am paasing it to the

Creating InAppPurchase in Cocos2d-x [closed]

久未见 提交于 2019-12-03 20:10:18
Closed. This question is off-topic. It is not currently accepting answers. Learn more . Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 6 years ago . I am new to Cocos2d-x.I need to create InAppPurchase For Cocos2d-x iOS game (CPP).can anybody help me to create InAppPurchase.or any Tutorials Related to this. Thanks in Advance. You can use obj.C version of inAp purchase in .cpp cocos2d-x project. All you need to do is just write bridge cpp class in .mm file. It works for iOS. //.cpp file say Player.cpp #include "MyGameBride.h" void Player:

Cocos开发中Visual Studio下HttpClient开发环境设置

[亡魂溺海] 提交于 2019-12-03 16:37:12
Cocos2d-x 3.x将与网络通信相关的类集成到libNetwork类库工程中,这其中包括了HttpClient类。我们需要在Visual Studio解决方案中添加libNetwork类库工程。 为了能够在Visual Studio 2012下HttpClient开发,我们需要设置内容如下: 在解决方案中添加libNetwork库工程。 添加libNetwork库引用。 配置头文件搜索路径。 配置libcurl库。 1、在解决方案中添加libNetwork库工程 首先,打开解决方案,右键点击解决方案HelloCpp,在右键菜单中选择,“添加”→ “现有项目”,然后在弹出对话框中选择libNetwork.vcxproj工程文件,具体的工程路径是“<工程目录>\cocos2d\cocos\network\proj.win32”。添加完成后,我们会看到解决方案中添加了libNetwork工程,如图所示。 添加libNetwork工程 2、添加libNetwork库引用 然后,我们在解决方案中右键点击游戏工程,在右键菜单中选择“属性”,弹出如图所示工程属性对话框,在属性对话框中选择“通用属性”→“框架和引用”,接着点击右边“添加新引用”按钮,在弹出对话框中选中“libNetwork”,最后点击“确定”按钮。 添加libNetwork库引用 3、配置头文件搜索路径 配置头文件搜索路径

multi resolution support for all android devices

有些话、适合烂在心里 提交于 2019-12-03 16:32:06
I am porting my cocos2d iPhone game to android using cocos2d-x. I am now facing a problem with screen resolution: I want to use one high resolution image in my game which should be supportable by all screens lower then a given resolution. I read this nice tutorial of multiple resolution on forum . It's really helpful, but I am not achieving my solution. There is explanation of scale-factor of resource of Design Resolution & Resource Resolution. But, in my case, it scales either height wise or width wise. Not a perfect scaling of my image. Can someone clarify why for me? In AppDeligate.cpp add

Use database (such as sqlite) with cocos2d-x

こ雲淡風輕ζ 提交于 2019-12-03 16:06:43
I am starting to build a gaming application on iphone. I am using cocos2d-x game engine, since it is easy to port to android from there. Also the coding is in C++, which I am very much familiar with. I want to know if there is a way to use any database with cocos2d-x. Although sqlite is preferred but not mandatory. I will have about 1/2 mb of data in the database. So, yes I have thought about keeping/using an in-memory database too, but I want my read/write queries to be time efficient. I have looked up at some of blogs, which suggest that I may need to use a C++ wrapper for sqlite. The