cocos2d-x-3.1 vs 输出Log的几种方法 (coco2d-x 学习笔记三)

log输出方法一:

使用log输出到vs控制台,当然了,这也可以跨平台输出log。(方便简单)

log("const char* :%s" ,str);  

log输出方法二:

修改main.cpp文件,如下:
#include "main.h"
#include "AppDelegate.h"
#include "cocos2d.h"

USING_NS_CC;

#define USE_WIN32_CONSOLE  

int APIENTRY _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);
	printf("hello--------------------------hello",NULL);
#endif  

    // create the application instance
    AppDelegate app;
    return Application::getInstance()->run();
#ifdef USE_WIN32_CONSOLE  
	FreeConsole();
#endif  
}






你可能感兴趣的:(cocos2d-x,cocos2d-x3.1,log)