您的位置:首页 > 移动开发 > Cocos引擎

cocos2d-html5在cocos2d-x里面打包编译

2014-02-20 17:15 399 查看
main.cpp打开USE_WIN32_CONSOLE输出

#include "main.h"
#include "AppDelegate.h"
#include "CCEGLView.h"

#define USE_WIN32_CONSOLE

USING_NS_CC;

// uncomment below line, open debug console
// #define USE_WIN32_CONSOLE

int APIENTRY _tWinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPTSTR    lpCmdLine,
int       nCmdShow)
{
UNREFERENCED_PARAMETER(hPrevInstance);
UNREFERENCED_PARAMETER(lpCmdLine);

#ifdef USE_WIN32_CONSOLE
AllocConsole();
freopen("CONIN$", "r", stdin);
freopen("CONOUT$", "w", stdout);
freopen("CONOUT$", "w", stderr);
#endif


#include "main.h"
#include "AppDelegate.h"
#include "CCEGLView.h"

#define USE_WIN32_CONSOLE

USING_NS_CC;

// uncomment below line, open debug console
// #define USE_WIN32_CONSOLE

int APIENTRY _tWinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPTSTR    lpCmdLine,
int       nCmdShow)
{
UNREFERENCED_PARAMETER(hPrevInstance);
UNREFERENCED_PARAMETER(lpCmdLine);

#ifdef USE_WIN32_CONSOLE
AllocConsole();
freopen("CONIN$", "r", stdin);
freopen("CONOUT$", "w", stdout);
freopen("CONOUT$", "w", stderr);
#endif


CCEGLView* eglView = CCEGLView::sharedOpenGLView();
eglView->setViewName("游戏名");
eglView->setFrameSize(960, 1440);


修改AppDelegate.cpp里面启动的js脚步

#if JSB_ENABLE_DEBUGGER
ScriptingCore::getInstance()->enableDebugger();
ScriptingCore::getInstance()->runScript("main.debug.js");
#else
ScriptingCore::getInstance()->runScript("游戏名-jsb.js");
#endif


和屏幕大小

// Set the design resolution
CCEGLView::sharedOpenGLView()->setDesignResolutionSize(960, 640, kResolutionShowAll);


在ScriptingCore.cpp(D:\DevTool\cocos2d-x-2.2.2\cocos2d-x-2.2.2\scripting\javascript\bindings)

void ScriptingCore::reportError(JSContext *cx, const char *message, JSErrorReport *report)
{
js_log("%s:%u:%s\n",
report->filename ? report->filename : "<no filename=\"filename\">",
(unsigned int) report->lineno,
message);
};


里面加个断点,方便看脚步出错问题
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: