YSTest  PreAlpha_b400_20130424
The YSLib Test Project
 全部  命名空间 文件 函数 变量 类型定义 枚举 枚举值 友元 宏定义  
Debug.cpp
浏览该文件的文档.
1 /*
2  Copyright (C) by Franksoft 2009 - 2012.
3 
4  This file is part of the YSLib project, and may only be used,
5  modified, and distributed under the terms of the YSLib project
6  license, LICENSE.TXT. By continuing to use, modify, or distribute
7  this file you indicate that you have read the license and
8  understand and accept it fully.
9 */
10 
28 #include "YCLib/Debug.h"
29 #include "YCLib/Input.h"
30 #include "YCLib/Video.h" // for platform::ColorSpace;
31 #include <cstdarg>
32 
33 namespace platform
34 {
35 
36 namespace
37 {
38  static bool bDebugStatus(true);
39 } // unnamed namespace;
40 
41 void
43 {
44  bDebugStatus = s;
45 }
46 
47 bool
49 {
50  return bDebugStatus;
51 }
52 
53 void
55 {
56  if(bDebugStatus)
58 }
59 
60 void
62 {
63  if(bDebugStatus)
64  {
65  YDebugBegin();
66  WaitForInput();
67  }
68 }
69 void
70 YDebug(const char* s)
71 {
72  if(bDebugStatus)
73  {
74  YDebugBegin();
75  std::puts(s);
76  WaitForInput();
77  }
78 }
79 
80 int
81 yprintf(const char* str, ...)
82 {
83  int t = -1;
84 
85  if(bDebugStatus)
86  {
87  YDebugBegin();
88 
89  std::va_list list;
90 
91  va_start(list, str);
92 
93  t = std::vprintf(str, list);
94 
95  va_end(list);
96  WaitForInput();
97  }
98  return t;
99 }
100 
101 } // namespace platform;
102