cocos2dx 3.17 lua 运行带控制台输出

非 Y 不嫁゛ 提交于 2020-01-16 10:05:11

1.查看新建项目里面的win32/main.cpp.

2.修改入口函数内容

#include "main.h"
#include "SimulatorWin.h"
#include <shellapi.h>

#define USE_WIN32_CONSOLE  //加入

int WINAPI _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

    //auto simulator = SimulatorWin::getInstance(); //屏蔽
    //return simulator->run(); //屏蔽 

    int ret = SimulatorWin::getInstance()->run(); //下面加入

#ifdef USE_WIN32_CONSOLE
    FreeConsole();
#endif

    return ret;
    
}

3.重新编译运行就可以了。

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!