Coder Social home page Coder Social logo

u0u0 / cocos2d-lua-community Goto Github PK

View Code? Open in Web Editor NEW
212.0 11.0 77.0 233.33 MB

基于Cocos2d-x 4.0,打造易用稳定的Cocos2d-x lua引擎。

CMake 0.56% Python 0.08% C++ 90.42% Objective-C 0.82% C 2.35% Objective-C++ 1.82% Java 1.44% GLSL 0.40% Lua 2.12% Shell 0.01% AIDL 0.01%
cocos2d-x cocostudio dragonbones spine lua luajit

cocos2d-lua-community's People

Contributors

8liang avatar bwaiox avatar leelyn avatar u0u0 avatar xitontong avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

cocos2d-lua-community's Issues

Android权限crash

文件 cocos/platform/android/java/src/org/cocos2dx/lib/Cocos2dxActivity.java

string[] permissions= {}; 修改为ArrayList<String> permissions = new ArrayList<String>();

private void initPermission() {
        if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
            String allpermissions[] = {Manifest.permission.ACCESS_NETWORK_STATE, Manifest.permission.READ_PHONE_STATE};
            ArrayList<String> permissions = new ArrayList<String>();
            boolean needPop = false;

            for (String permission : allpermissions) {
                if (PackageManager.PERMISSION_DENIED == ContextCompat.checkSelfPermission(this, permission)) {
                    if (shouldShowRequestPermissionRationale(permission)) {
                        permissions.add(permission);
                    } else {
                        needPop = true;
                    }
                }
            }

            if (needPop) {
                // init Alert strings
                String title = "请在设置中,开启程序权限, 点击权限。";
                String conform = "确认";
                String cancel = "取消";
                if (Cocos2dxHelper.getCurrentLanguage() != "zh") {
                    title = "Please grant the permissions in settings.";
                    conform = "OK";
                    cancel = "Cancel";
                }
                final String fTitle = title;
                final String fconform = conform;
                final String fcancel = cancel;

                // on clicked handler
                final DialogInterface.OnClickListener okHandler = new DialogInterface.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface dialog, int which) {
                        Intent intent = new Intent();
                        intent.setAction(Settings.ACTION_APPLICATION_DETAILS_SETTINGS);
                        Uri uri = Uri.fromParts("package", getPackageName(), null);
                        intent.setData(uri);
                        startActivity(intent);
                        finish();
                    }
                };

                // on clicked handler
                final DialogInterface.OnClickListener noHandler = new DialogInterface.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface dialog, int which) {
                        finish();
                    }
                };

                // new alert
                sContext.runOnUiThread(new Runnable() {
                    @Override
                    public void run() {
                        new AlertDialog.Builder(sContext)
                                .setMessage(fTitle)
                                .setPositiveButton(fconform, okHandler)
                                .setNegativeButton(fcancel, noHandler)
                                .create()
                                .show();
                    }
                });
                return;
            }

            if (permissions.size() > 0) {
                this.requestPermissions( permissions.toArray(new String[permissions.size()]), 1001);
                return;
            }
        }
        // final, can safe init PS module
        PSNetwork.init(this);
        PSDevice.init(this);
    }

gradle 升级到 7.x

升级到 7.x 后,

  1. gradle wrapper 升级: gradlew, gradlew.bat, gradle/wrapper/gradle-wrapper.jar
  2. 更新 settings.gradle, build.gradle 两个文件内容格式稍作调整

新的音频播放器RDAudio存在内存泄漏

测试代码如下

    local printLua = UIImageBox.new("update/public_btn_003.png",function()
    	self:stopAllActions()
		self:runAction(cc.RepeatForever:create(cc.Sequence:create(
				cc.DelayTime:create(0.01),
				cc.CallFunc:create(function ()
					for i = 1, 100 do
                                                local id = math.random() .. os.time()
						audio.playEffectSync(id, “test.ogg”, false)
					end
				end)
			)))
    end,{textParams = {text = "开始", size = 30, color = CoreColor.GENERAL_WORDS, font = HYH3GJ}, NOPLIS = true })
    display.align(printLua, display.LEFT_BOTTOM, 0, 0)
    self:addChild(printLua, 100000)

    local printOjbs = UIImageBox.new("update/public_btn_003.png",function()
		self:stopAllActions()
    	audio.stopAllEffects()
        audio.unloadAllFile()
    end,{textParams = {text = "结束", size = 30, color = CoreColor.GENERAL_WORDS, font = HYH3GJ}, NOPLIS = true })
    display.align(printOjbs, display.LEFT_BOTTOM, 150, 0)
    self:addChild(printOjbs, 100000)

开始和结束按钮,隔1到2秒来回点击,如此重复
就会发现内存不断增长

目前发现的一个解决办法
lua_audio_manual.cpp文件中
lSourceGC方法改成下面这样

static int lSourceGC(lua_State *L)
{
    RDAudioItem *sourceItem = (RDAudioItem *)luaL_checkudata(L, 1, RD_AUDIO_SOURCE);
    if (!sourceItem->deleted) {
        alSourcei(sourceItem->id, AL_BUFFER, 0);
        alDeleteSources(1, &sourceItem->id);
        sourceItem->deleted = true;
    }
    return 0;// number of return values
}

麻烦查看下这个bug,并看下解决方案对不对

tolua

tolua 工具删除了,是使用其他方式生成的lua_bindings 嘛?

重新编译咋搞呀

咋没找到C++工程的,因为想改写里面的C++组件,想重新编译一下。

启用 androidx

考虑到 support 官方早已切换到 androidx, 还是启用 androix, 和 jetifier.

编译CreateProject.py创建的工程出现error LINK2019

31>cocos2d.lib(CCFileUtils.obj) : error LNK2019: 无法解析的外部符号 "__declspec(dllimport) void * __cdecl cocos2d::unzOpen(char const *)" (_imp?unzOpen@cocos2d@@YAPAXPBD@Z),函数 "public: unsigned char * __thiscall cocos2d::FileUtils::getFileDataFromZip(class std::basic_string<char,struct std::char_traits,class std::allocator > const &,class std::basic_string<char,struct std::char_traits,class std::allocator > const &,long *)const " (?getFileDataFromZip@FileUtils@cocos2d@@QBEPAEABV?$basic_string@DU?$char_traits@D@std@@v?$allocator@D@2@@std@@0paj@Z) 中引用了该符号
31>cocos2d.lib(ZipUtils.obj) : error LNK2001: 无法解析的外部符号 "__declspec(dllimport) void * __cdecl cocos2d::unzOpen(char const *)" (_imp?unzOpen@cocos2d@@YAPAXPBD@Z)
31>cocos2d.lib(CCFileUtils.obj) : error LNK2019: 无法解析的外部符号 "__declspec(dllimport) int __cdecl cocos2d::unzClose(void *)" (_imp?unzClose@cocos2d@@YAHPAX@Z),函数 "public: unsigned char * __thiscall cocos2d::FileUtils::getFileDataFromZip(class std::basic_string<char,struct std::char_traits,class std::allocator > const &,class std::basic_string<char,struct std::char_traits,class std::allocator > const &,long *)const " (?getFileDataFromZip@FileUtils@cocos2d@@QBEPAEABV?$basic_string@DU?$char_traits@D@std@@v?$allocator@D@2@@std@@0paj@Z) 中引用了该符号
31>cocos2d.lib(ZipUtils.obj) : error LNK2001: 无法解析的外部符号 "__declspec(dllimport) int __cdecl cocos2d::unzClose(void *)" (_imp?unzClose@cocos2d@@YAHPAX@Z)
31>cocos2d.lib(CCFileUtils.obj) : error LNK2019: 无法解析的外部符号 "__declspec(dllimport) int __cdecl cocos2d::unzOpenCurrentFile(void *)" (_imp?unzOpenCurrentFile@cocos2d@@YAHPAX@Z),函数 "public: unsigned char * __thiscall cocos2d::FileUtils::getFileDataFromZip(class std::basic_string<char,struct std::char_traits,class std::allocator > const &,class std::basic_string<char,struct std::char_traits,class std::allocator > const &,long *)const " (?getFileDataFromZip@FileUtils@cocos2d@@QBEPAEABV?$basic_string@DU?$char_traits@D@std@@v?$allocator@D@2@@std@@0paj@Z) 中引用了该符号
31>cocos2d.lib(ZipUtils.obj) : error LNK2001: 无法解析的外部符号 "__declspec(dllimport) int __cdecl cocos2d::unzOpenCurrentFile(void *)" (_imp?unzOpenCurrentFile@cocos2d@@YAHPAX@Z)
31>cocos2d.lib(CCFileUtils.obj) : error LNK2019: 无法解析的外部符号 "__declspec(dllimport) int __cdecl cocos2d::unzReadCurrentFile(void *,void *,unsigned int)" (_imp?unzReadCurrentFile@cocos2d@@YAHPAX0I@Z),函数 "public: unsigned char * __thiscall cocos2d::FileUtils::getFileDataFromZip(class std::basic_string<char,struct std::char_traits,class std::allocator > const &,class std::basic_string<char,struct std::char_traits,class std::allocator > const &,long *)const " (?getFileDataFromZip@FileUtils@cocos2d@@QBEPAEABV?$basic_string@DU?$char_traits@D@std@@v?$allocator@D@2@@std@@0paj@Z) 中引用了该符号
31>cocos2d.lib(ZipUtils.obj) : error LNK2001: 无法解析的外部符号 "__declspec(dllimport) int __cdecl cocos2d::unzReadCurrentFile(void *,void *,unsigned int)" (_imp?unzReadCurrentFile@cocos2d@@YAHPAX0I@Z)
31>cocos2d.lib(CCFileUtils.obj) : error LNK2019: 无法解析的外部符号 "__declspec(dllimport) int __cdecl cocos2d::unzGetCurrentFileInfo(void *,struct cocos2d::unz_file_info_s *,char *,unsigned short,void *,unsigned short,char *,unsigned short)" (_imp?unzGetCurrentFileInfo@cocos2d@@YAHPAXPAUunz_file_info_s@1@PADG0G2G@Z),函数 "public: unsigned char * __thiscall cocos2d::FileUtils::getFileDataFromZip(class std::basic_string<char,struct std::char_traits,class std::allocator > const &,class std::basic_string<char,struct std::char_traits,class std::allocator > const &,long *)const " (?getFileDataFromZip@FileUtils@cocos2d@@QBEPAEABV?$basic_string@DU?$char_traits@D@std@@v?$allocator@D@2@@std@@0paj@Z) 中引用了该符号
31>cocos2d.lib(ZipUtils.obj) : error LNK2001: 无法解析的外部符号 "__declspec(dllimport) int __cdecl cocos2d::unzGetCurrentFileInfo(void *,struct cocos2d::unz_file_info_s *,char *,unsigned short,void *,unsigned short,char *,unsigned short)" (_imp?unzGetCurrentFileInfo@cocos2d@@YAHPAXPAUunz_file_info_s@1@PADG0G2G@Z)
31>cocos2d.lib(CCFileUtils.obj) : error LNK2019: 无法解析的外部符号 "__declspec(dllimport) int __cdecl cocos2d::unzCloseCurrentFile(void *)" (_imp?unzCloseCurrentFile@cocos2d@@YAHPAX@Z),函数 "public: unsigned char * __thiscall cocos2d::FileUtils::getFileDataFromZip(class std::basic_string<char,struct std::char_traits,class std::allocator > const &,class std::basic_string<char,struct std::char_traits,class std::allocator > const &,long *)const " (?getFileDataFromZip@FileUtils@cocos2d@@QBEPAEABV?$basic_string@DU?$char_traits@D@std@@v?$allocator@D@2@@std@@0paj@Z) 中引用了该符号
31>cocos2d.lib(ZipUtils.obj) : error LNK2001: 无法解析的外部符号 "__declspec(dllimport) int __cdecl cocos2d::unzCloseCurrentFile(void *)" (_imp?unzCloseCurrentFile@cocos2d@@YAHPAX@Z)
31>cocos2d.lib(CCFileUtils.obj) : error LNK2019: 无法解析的外部符号 "__declspec(dllimport) int __cdecl cocos2d::unzLocateFile(void *,char const ,int (__cdecl)(void *,char const *,char const *))" (_imp?unzLocateFile@cocos2d@@YAHPAXPBDP6AH011@Z@Z),函数 "public: unsigned char * __thiscall cocos2d::FileUtils::getFileDataFromZip(class std::basic_string<char,struct std::char_traits,class std::allocator > const &,class std::basic_string<char,struct std::char_traits,class std::allocator > const &,long *)const " (?getFileDataFromZip@FileUtils@cocos2d@@QBEPAEABV?$basic_string@DU?$char_traits@D@std@@v?$allocator@D@2@@std@@0paj@Z) 中引用了该符号
31>cocos2d.lib(ZipUtils.obj) : error LNK2019: 无法解析的外部符号 "__declspec(dllimport) void * __cdecl cocos2d::unzOpen2(char const *,struct zlib_filefunc_def_s *)" (_imp?unzOpen2@cocos2d@@YAPAXPBDPAUzlib_filefunc_def_s@@@z),函数 "private: bool __thiscall cocos2d::ZipFile::initWithBuffer(void const *,unsigned long)" (?initWithBuffer@ZipFile@cocos2d@@AAE_NPBXK@Z) 中引用了该符号
31>cocos2d.lib(ZipUtils.obj) : error LNK2019: 无法解析的外部符号 "__declspec(dllimport) int __cdecl cocos2d::unzGoToFirstFile(void *)" (_imp?unzGoToFirstFile@cocos2d@@YAHPAX@Z),函数 "public: class std::basic_string<char,struct std::char_traits,class std::allocator > __thiscall cocos2d::ZipFile::getFirstFilename(void)" (?getFirstFilename@ZipFile@cocos2d@@QAE?AV?$basic_string@DU?$char_traits@D@std@@v?$allocator@D@2@@std@@xz) 中引用了该符号
31>cocos2d.lib(ZipUtils.obj) : error LNK2019: 无法解析的外部符号 "__declspec(dllimport) int __cdecl cocos2d::unzGoToFirstFile2(void *,struct cocos2d::unz_file_info64_s *,char *,unsigned short,void *,unsigned short,char *,unsigned short)" (_imp?unzGoToFirstFile2@cocos2d@@YAHPAXPAUunz_file_info64_s@1@PADG0G2G@Z),函数 "public: bool __thiscall cocos2d::ZipFile::setFilter(class std::basic_string<char,struct std::char_traits,class std::allocator > const &)" (?setFilter@ZipFile@cocos2d@@QAE_NABV?$basic_string@DU?$char_traits@D@std@@v?$allocator@D@2@@std@@@z) 中引用了该符号
31>cocos2d.lib(ZipUtils.obj) : error LNK2019: 无法解析的外部符号 "__declspec(dllimport) int __cdecl cocos2d::unzGoToNextFile(void *)" (_imp?unzGoToNextFile@cocos2d@@YAHPAX@Z),函数 "public: class std::basic_string<char,struct std::char_traits,class std::allocator > __thiscall cocos2d::ZipFile::getNextFilename(void)" (?getNextFilename@ZipFile@cocos2d@@QAE?AV?$basic_string@DU?$char_traits@D@std@@v?$allocator@D@2@@std@@xz) 中引用了该符号
31>cocos2d.lib(ZipUtils.obj) : error LNK2019: 无法解析的外部符号 "__declspec(dllimport) int __cdecl cocos2d::unzGoToNextFile2(void *,struct cocos2d::unz_file_info64_s *,char *,unsigned short,void *,unsigned short,char *,unsigned short)" (_imp?unzGoToNextFile2@cocos2d@@YAHPAXPAUunz_file_info64_s@1@PADG0G2G@Z),函数 "public: bool __thiscall cocos2d::ZipFile::setFilter(class std::basic_string<char,struct std::char_traits,class std::allocator > const &)" (?setFilter@ZipFile@cocos2d@@QAE_NABV?$basic_string@DU?$char_traits@D@std@@v?$allocator@D@2@@std@@@z) 中引用了该符号
31>cocos2d.lib(ZipUtils.obj) : error LNK2019: 无法解析的外部符号 "__declspec(dllimport) int __cdecl cocos2d::unzGetFilePos(void *,struct cocos2d::unz_file_pos_s *)" (_imp?unzGetFilePos@cocos2d@@YAHPAXPAUunz_file_pos_s@1@@z),函数 "public: bool __thiscall cocos2d::ZipFile::setFilter(class std::basic_string<char,struct std::char_traits,class std::allocator > const &)" (?setFilter@ZipFile@cocos2d@@QAE_NABV?$basic_string@DU?$char_traits@D@std@@v?$allocator@D@2@@std@@@z) 中引用了该符号
31>cocos2d.lib(ZipUtils.obj) : error LNK2019: 无法解析的外部符号 "__declspec(dllimport) int __cdecl cocos2d::unzGoToFilePos(void *,struct cocos2d::unz_file_pos_s *)" (_imp?unzGoToFilePos@cocos2d@@YAHPAXPAUunz_file_pos_s@1@@z),函数 "public: unsigned char * __thiscall cocos2d::ZipFile::getFileData(class std::basic_string<char,struct std::char_traits,class std::allocator > const &,long *)" (?getFileData@ZipFile@cocos2d@@QAEPAEABV?$basic_string@DU?$char_traits@D@std@@v?$allocator@D@2@@std@@paj@Z) 中引用了该符号
31>D:\Cocos-Lua\game\win32-build\bin\game\Debug\game.exe : fatal error LNK1120: 14 个无法解析的外部命令

使用是visual studio2022

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.