zoukankan      html  css  js  c++  java
  • cocos2d-html5在cocos2d-x里面打包编译

    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:DevToolcocos2d-x-2.2.2cocos2d-x-2.2.2scriptingjavascriptindings)

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

    里面加个断点,方便看脚步出错问题

  • 相关阅读:
    jquery实现checkbox列表的全选不选
    SQL server 无法更新标识列
    如何设置IIS程序池的回收时间,才能最大程度的减少对用户的影响?
    混合式App开发 Apicloud 官方iPhone X 适配
    C# 加密解密以及sha256不可逆加密案例
    C#排队处理DEMO
    vs中如何统计整个项目的代码行数
    ApiCloud利用NVTabBar模块快速搭建起APP的框架
    走进异步编程的世界--async/await项目使用实战
    H5开发APP考题和答案
  • 原文地址:https://www.cnblogs.com/linn/p/3558052.html
Copyright © 2011-2022 走看看