当前位置: 代码迷 >> 综合 >> cocos2dx 3.17 lua 运行带控制台输出
  详细解决方案

cocos2dx 3.17 lua 运行带控制台输出

热度:98   发布时间:2024-01-25 00:39:12.0

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.重新编译运行就可以了。