依赖项目位于下载的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/@R_419_6843@""$(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-C@R_419_6843@matic 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 @R_419_6843@matic reference countingmode
[JsonWriter release];
解决方法:Objective-C @R_419_6843@matic 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
总结以上是内存溢出为你收集整理的【H5+ & Quick-cocos2dx整合】之iOS 三 集成Quick-Cocos2dx SDK全部内容,希望文章能够帮你解决【H5+ & Quick-cocos2dx整合】之iOS 三 集成Quick-Cocos2dx SDK所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)