Game Engine Architecture 9

1、Formatted Output with OutputDebugString()

SRE实战 互联网时代守护先锋,助力企业售后服务体系运筹帷幄!一键直达领取阿里云限量特价优惠。 Game Engine Architecture 9 随笔 第1张
int VDebugPrintF(const char* format, va_list argList)
{
    const U32 MAX_CHARS = 1024;
    static char s_buffer[MAX_CHARS];
    
    int charsWritten
    = vsnprintf(s_buffer, MAX_CHARS, format, argList);
    
    // Now that we have a formatted string, call the
    // Win32 API.
    OutputDebugString(s_buffer);
    
    return charsWritten;
}

int DebugPrintF(const char* format, ...)
{
    va_list argList;
    va_start(argList, format);
    
    int charsWritten = VDebugPrintF(format, argList);
    
    va_end(argList);
    return charsWritten;
}
View Code

  It’s impossible to pass ellipses from one function to another, but it is possible to pass va_lists around. 

2、Mirroring Output to a File

  You may want to consider flushing your log file(s) after every call to your debug output function to ensure that if the game crashes, the log file(s) won’t be missing the last buffer-full of output. The last data printed are usually the most useful for determining the cause of a crash, so we want to be sure that the log file always contains the most up-to-date output.

3、Debug Drawing API

  Game Engine Architecture 9 随笔 第3张

4、In-Game Menus

  Game Engine Architecture 9 随笔 第4张

5、In-Game Console

  Game Engine Architecture 9 随笔 第5张

5、In-Game Memory Stats and Leak Detection

  当申请内存失败时,在适当的地方弹出一个提示。

6、

7、

8、

9、

10、

11、

12、

扫码关注我们
微信号:SRE实战
拒绝背锅 运筹帷幄