版本:cocos2dx-3.1.5+vs2013
打开当前项目的 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_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();
AppDelegate app;
int ret = Application::getInstance()->run();
#ifdef USE_WIN32_CONSOLE
FreeConsole();
#endif
return ret;
}
运行如下图所示
版权声明:本文为mhtqq809201原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。