Android和win32已经测试通过,理论上IOS也可以。
1、AssetsManagerDelegateProtocol
AssetsManagerDelegateProtocol,用于与服务器校验版本号,更新下载资源包,并对成功、出错、下载进度等进行回调。
2、资源包名称
所下载资源包名称默认为:cocos2dx-update-temp-package.zip。
如果想要修改文件名,直接修改引擎下 extensionsassets-managerAsetsManager.ccp中的TEMP_PACKAGE_FILE_N……继续阅读 »
sharezer
9年前 (2015-11-27) 2758浏览 0评论
2个赞
RenderTexture* texture = RenderTexture::create(64, 64);
texture->begin();
this->visit();
texture->end();
texture->saveToFile("screen.png");
如上使用RenderTexture创建了64*64的区域。
Win32下在buildDebug.win32 目录下可以找到保存的screen.png.
默认从右下角开始截取。
……继续阅读 »
sharezer
9年前 (2015-11-27) 2497浏览 0评论
1个赞
// My Example 图片加密测试,images.pvr.ccz,images.plist
//88558730 4af885af f4539888 8ed3b5aa
ZipUtils::ccSetPvrEncryptionKey(0x88558730 , 0x4af885af , 0xf4539888 , 0x8ed3b5aa);
CCSpriteFrameCache::sharedSpriteFrameCache()->addSpriteFramesWithFile("test.plist");
CCSprite* sprite = CCSprite::……继续阅读 »
sharezer
9年前 (2015-11-27) 3944浏览 0评论
2个赞
Andriod的CocoStudio和NetWork环境,要在Android.mk中增加:
LOCAL_WHOLE_STATIC_LIBRARIES += cocos_extension_static
LOCAL_WHOLE_STATIC_LIBRARIES += cocos_gui_static
LOCAL_WHOLE_STATIC_LIBRARIES += cocostudio_static
LOCAL_WHOLE_STATIC_LIBRARIES += cocos_network_static
$(call impor……继续阅读 »
sharezer
9年前 (2015-11-27) 2032浏览 0评论
1个赞
Cocos2d-x 3.0 以后,运行build_native.py 直接编译打包apk。
build_native.py会将Resources中的内容直接拷贝assets中,如果Resoucres有版本控制。.svn文件夹一样会被拷贝过去。
当assets目录中已经存在.svn文件夹时,就会编译报错。
所以每次运行py文件前都要先把assets清空。
也通过修改build_native.py,来达到不拷贝.svn文件夹的目的。
def copy_files(src, dst):
for item in os.listdir(src):
……继续阅读 »
sharezer
9年前 (2015-10-22) 2037浏览 0评论
1个赞
到3.1.1以后仍然有这个问题。
下图只加了一个ListView。帧数直接掉了十到二十帧。
只需要修改AppActivity.java,将TestCpp里面的代码直接拷贝进去覆盖,即可解决上述问题。
public Cocos2dxGLSurfaceView onCreateView()
{
Cocos2dxGLSurfaceView glSurfaceView = new Cocos2dxGLSurfaceView(this);
// TestCpp should create stencil buffer
g……继续阅读 »
sharezer
9年前 (2015-10-22) 3642浏览 0评论
1个赞
#include "JsonBox.h"
std::string path = "test.json”;
//注意引入路径
path = cocos2d::CCFileUtils::sharedFileUtils()->fullPathForFilename(path.c_str());
/*写入文件*/
JsonBox::Object o;
o["myName"] = JsonBox::Value(123);
o["myOtherMember"] = JsonBox::Value("asld\kfn&q……继续阅读 »
sharezer
9年前 (2015-10-22) 2723浏览 0评论
1个赞
Cocos2d-X 3.0 中自带了rapidjson,用于解析Json。
可以直接拿过来使用,只要引入头文件
#include "json/document.h"
char json[100] = "{"hello": "world"}";
rapidjson::Document d1;
d1.Parse<0>(json);
log("json1: %s", d1["hello"].GetString());
//2.从文件读取
std::string f……继续阅读 »
sharezer
9年前 (2015-10-22) 1949浏览 0评论
1个赞