Home  >  Article  >  Database  >  教你在vs2010下输出cocos2d

教你在vs2010下输出cocos2d

WBOY
WBOYOriginal
2016-06-07 15:30:481168browse

上次在xcode下,使用printf直接在调试窗口可以看到输出的信息,在vs2010中没有看到,于是查看了源代码,找到函数CCLog void CCLog(const char * pszFormat, ...){ char szBuf[MAX_LEN]; va_list ap; va_start(ap, pszFormat); vsnprintf_s(szBuf, MAX_LEN, M

上次在xcode下,使用printf直接在调试窗口可以看到输出的信息,在vs2010中没有看到,于是查看了源代码,找到函数CCLog

void CCLog(const char * pszFormat, ...)
{
    char szBuf[MAX_LEN];

    va_list ap;
    va_start(ap, pszFormat);
    vsnprintf_s(szBuf, MAX_LEN, MAX_LEN, pszFormat, ap);
    va_end(ap);

    WCHAR wszBuf[MAX_LEN] = {0};
    MultiByteToWideChar(CP_UTF8, 0, szBuf, -1, wszBuf, sizeof(wszBuf));
    OutputDebugStringW(wszBuf);
    OutputDebugStringA("\n");
}


看看它的实现吧。

使用CCLog代替printf后就可以在调试窗口看到输出信息。

在vs2010中 调试->输出,可以调出输出窗口。

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn