新建cocos(Win32)项目

前端之家收集整理的这篇文章主要介绍了新建cocos(Win32)项目前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

1.在vs新建一个win32(不是控台)的空项目

2.在c/c++ >>预处理器>> 预处理器定义

WIN32
_DEBUG
_WINDOWS
COCOS2D_DEBUG=1
_CRT_SECURE_NO_WARNINGS

2.c/c++ >>常规 >> 附加包含目录 设置 ($(Cocos2dX3_5_Home)这个是环境变量)

$(Cocos2dX3_5_Home)\cocos\platform;$(Cocos2dX3_5_Home)\extensions;$(Cocos2dX3_5_Home)\cocos\editor-support;$(Cocos2dX3_5_Home)\;$(Cocos2dX3_5_Home)\cocos\audio\include;./;$(Cocos2dX3_5_Home)\external\win32-specific\gles\include\OGLES;$(Cocos2dX3_5_Home)\external\glfw3\include\win32;$(Cocos2dX3_5_Home)\cocos\platform\desktop;$(Cocos2dX3_5_Home)\cocos\platform\win32;$(Cocos2dX3_5_Home)\cocos\2d;$(Cocos2dX3_5_Home)\external;$(Cocos2dX3_5_Home)\cocos;$(JAVA_HOME)\include;$(JAVA_HOME)\include\win32


3.链接器>>常规>>附加库目录>>$(Cocos2dX3_5_Home)\build\$(Configuration).win32\

4.链接器>>输入>>附加依赖项>>libcocos2d.lib;libchipmunk.lib;opengl32.lib;glew32.lib;libzlib.lib;libpng.lib;libjpeg.lib;libtiff.lib;libwebp.lib;libiconv.lib;glfw3.lib;freetype250.lib;winmm.lib;ws2_32.lib;libBox2D.lib;libcurl_imp.lib;%(AdditionalDependencies)

5.设置资源路径 在AppDelegate.cpp中


vector<string> searchPath; //搜索资源路径


searchPath.push_back(RESOURCE_PATH);


char _path[16] = {};
sprintf(_path,"../%s",RESOURCE_PATH);
searchPath.push_back(_path);


FileUtils::getInstance()->setSearchPaths(searchPath); //设置资源搜索路径


在AppDelegate.h


添加#define RESOURCE_PATH "Resources" //资源位置

原文链接:https://www.f2er.com/cocos2dx/343189.html

猜你在找的Cocos2d-x相关文章