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);
    };

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

  • 相关阅读:
    实战篇之实现 OutLook 中以 EDM 形式发送通知邮件
    ASP.NET MVC5 之路由器
    ASP.NET MVC5 之数据迁移
    说不出的烦
    ASP.NET MVC5 之 Log4Net 的学习和使用
    读取配置文件参数和文件路径
    序列化和反序列化示例
    面向对象之封装
    面向对象4之常用的乱七八糟
    面向对象三之继承和派生
  • 原文地址:https://www.cnblogs.com/linn/p/3558052.html
Copyright © 2011-2022 走看看