【H5+ & Quick-cocos2dx整合】之iOS 三 集成Quick-Cocos2dx
添加Quick-cocos的依赖项目依赖项目位于下载的Quick-Cocos2dx目录下 /build/cocos2d_libs.xcodeproj /cocos/scripting/lua-bindings/proj.ios_mac/ cocos2d_lua_bindings.xcodeproj 拖动这两个文件添加到项目下 Target à BuildPhases à Target Dependencies 单击“+”添加libcocos2d 和 libluacocos2d
添加Lib文件libcocos2d.a和libluacocos.a 添加头文件引用 /quick/lib/quick-src 注:需要手动移除在/ extra/platform中与ios不相关的引用(待写。。。) 添加引用包路径引入Frameworks:CoreMotion.framework StoreKit.framework GameController.framework OpenAL.framework 设置Header Search Paths$(inherited) $(QUICK_V3_ROOT)/cocos $(QUICK_V3_ROOT)/cocos $(QUICK_V3_ROOT)/cocos/base $(QUICK_V3_ROOT)/cocos/physics"$(QUICK_V3_ROOT)/cocos/math/kazmath""$(QUICK_V3_ROOT)/cocos/2d" "$(QUICK_V3_ROOT)/cocos/ui" "$(QUICK_V3_ROOT)/cocos/network""$(QUICK_V3_ROOT)/cocos/audio/include""$(QUICK_V3_ROOT)/cocos/editor-support""$(QUICK_V3_ROOT)/extensions" "$(QUICK_V3_ROOT)/external""$(QUICK_V3_ROOT)/external/chipmunk/include/chipmunk""$(QUICK_V3_ROOT)/external/lua/luajit/include""$(QUICK_V3_ROOT)/external/lua/tolua""$(QUICK_V3_ROOT)/external/glfw3/include/mac""$(QUICK_V3_ROOT)/external/lua/luajit/include""$(QUICK_V3_ROOT)/cocos/scripting/lua-bindings/manual""$(QUICK_V3_ROOT)/cocos/scripting/lua-bindings/auto""$(QUICK_V3_ROOT)/cocos/scripting/lua-bindings/manual"$(QUICK_V3_ROOT)/quick/lib/quick-src"$(QUICK_V3_ROOT)/quick/lib/quick-src/extra""$(QUICK_V3_ROOT)/external/protobuf-lite/src" 设置User Header Search Paths:$(inherited) "$(QUICK_V3_ROOT)/cocos/platform/ios""$(QUICK_V3_ROOT)/external/curl/include/ios" 设置Framework Search PathsCCLibs(该目录自行创建,只包含一个opengl.framework,该文件在cocos2dx中能找到) 编译参数配置:Objective-CAutomatic Reference Counting à No Always SearchUser Paths à Yes PrecompilePrefix Header à Yes Prefix Header à H5_Cocos_Integrate/Prefix.pch Prefix.pch #ifdef __OBJC__ #import <Foundation/Foundation.h> #import <UIKit/UIKit.h> #endif 设置宏变量(Preprocessor Macros)Debug:$(inherited) COCOS2D_DEBUG=1 USE_FILE32API CC_LUA_ENGINE_ENABLED=1 CC_ENABLE_CHIPMUNK_INTEGRATION=1 CC_TARGET_OS_IPHONE Release:CC_TARGET_OS_IPHONE $(inherited) CC_ENABLE_CHIPMUNK_INTEGRATION=1 CC_LUA_ENGINE_ENABLED=1 USE_FILE32API 集成cocos2dx代码代码生成可以通过quick-cocos2dx创建一个工程,找到下图中四个类文件,引用到项目中。
注:AppDelegate.cpp改为AppDelegate.mm,一是为了OC和C++混编引用自己定义的app管理类,便于h5和cocos2dx之间的协调工作。 添加Demo资源同样通过Quick-Cocos2dx创建一个demo工程,拷贝其中res和src目录到项目中,并引用。 可以通过Copy Bundle Resources添加引用。 错误示例错误:oc编译参数错误quick-src/extra/platform/ios/json/SBJSON.m:46:17:error: 'release' is unavailable: not available in automatic reference countingmode [jsonWriter release]; 解决方法:Objective-C Automatic Reference Counting à No 错误:设置宏变量/Users/katichar/H5Plus_QuickCocos2dx_Integrate/frameworks/CCLibs/OpenGL.framework/Versions/A/Headers/glext.h:2289:49:Unknown type name 'GLdouble'; did you mean 'double'? debug: $(inherited) COCOS2D_DEBUG=1 USE_FILE32APICC_LUA_ENGINE_ENABLED=1 CC_ENABLE_CHIPMUNK_INTEGRATION=1 CC_TARGET_OS_IPHONE release: CC_TARGET_OS_IPHONE $(inherited)CC_ENABLE_CHIPMUNK_INTEGRATION=1 CC_LUA_ENGINE_ENABLED=1 USE_FILE32API 错误:缺少StoreKit.framework"_OBJC_CLASS_$_SKPayment",referenced from: objc-class-ref in CCStoreIOS.o 错误:缺少CoreMotion.framework"_OBJC_CLASS_$_CMMotionManager",referenced from: objc-class-ref in libcocos2diOS.a(CCDevice-ios.o)
删除部分: protobuf—pb.o md5
TargetàBuildSettingsàApple LLVM7.1 – Language à Precompile Prefix Header àYes Prefix Header à H5_Cocos_Integrate/Prefix.pch (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
- jQuery使用$.ajax进行异步刷新的方法(附demo下载)
- ruby-on-rails – 如何按日期计数获得此postgres组包括0天
- xml – 将UTF8数据导出到Excel的最好方法是什么?
- 掌握 Dojo 工具包,第 2 部分: XHR 框架与 Dojo
- 验证所有依赖项的java compact配置文件
- swfupload组件后台获取中文文件名乱码的问题解决
- C#子线程更新UI控件的方法实例总结
- c# – 当Verb =“runas”时设置ProcessStartInfo.Environme
- c# – Entity Framework核心:无法添加迁移:无参数构造函数
- C# 实现对PPT文档加密、解密以及重置密码的操作