cocos2dx-3.1.5中lua显示控制台输出窗口

来源:互联网 发布:php鸟叔 编辑:程序博客网 时间:2024/05/16 01:49

版本:cocos2dx-3.1.5+vs2013

打开当前项目的 main.cpp

main.cpp路径

文件内容应该是这样的

#include "main.h"#include "SimulatorWin.h"#include <shellapi.h>int WINAPI _tWinMain(HINSTANCE hInstance,    HINSTANCE hPrevInstance,    LPTSTR    lpCmdLine,    int       nCmdShow){    UNREFERENCED_PARAMETER(hPrevInstance);    UNREFERENCED_PARAMETER(lpCmdLine);    auto simulator = SimulatorWin::getInstance();    return simulator->run();}

修改成下面的:

#include "main.h"//#include "SimulatorWin.h"#include "AppDelegate.h"//#include <shellapi.h>USING_NS_CC;#define USE_WIN32_CONSOLEint 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();    AppDelegate app;    int ret = Application::getInstance()->run();#ifdef USE_WIN32_CONSOLE    FreeConsole();#endif    return ret;}

运行如下图所示

调试窗口