在cocos2dx中开启我们熟悉的控制台输出,可以查看日志,例如像C接口中的printf();函数。
int APIENTRY _tWinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPTSTR lpCmdLine,
int nCmdShow)
{
#if defined(WIN32) && defined(_DEBUG)
// 开启控制台
AllocConsole();
// 申请读
freopen( "CONIN$", "r+t", stdin );
// 输出
freopen( "CONOUT$","w",stdout);
#endif
}
在程序入口main里添加以上几行代码就可以了。