Hasty Badger
Small UI library (a branch of Turbo Badger)
 All Classes Namespaces Functions Variables Enumerations Enumerator Friends Groups Pages
tb_debug.h
1 // ================================================================================
2 // == This file is a part of Turbo Badger. (C) 2011-2014, Emil SegerÃ¥s ==
3 // == See tb_core.h for more information. ==
4 // ================================================================================
5 
6 #ifndef TB_DEBUG_H
7 #define TB_DEBUG_H
8 
9 #include "tb_types.h"
10 
11 #ifdef TB_RUNTIME_DEBUG_INFO
12 #define TB_IF_DEBUG(debug) debug
13 #else
14 #define TB_IF_DEBUG(debug)
15 #endif
16 
17 namespace tb {
18 
19 #ifdef TB_RUNTIME_DEBUG_INFO
20 
21 class TBDebugInfo
22 {
23 public:
24  TBDebugInfo();
25 
26  enum SETTING {
28  LAYOUT_BOUNDS,
30  LAYOUT_CLIPPING,
33  LAYOUT_PS_DEBUGGING,
36  RENDER_BATCHES,
38  RENDER_SKIN_BITMAP_FRAGMENTS,
41  RENDER_FONT_BITMAP_FRAGMENTS,
42 
43  NUM_SETTINGS
44  };
45  long settings[NUM_SETTINGS];
46 };
47 
48 extern TBDebugInfo g_tb_debug;
49 
51 void ShowDebugInfoSettingsWindow(class TBWidget *root);
52 
53 #define TB_DEBUG_SETTING(setting) g_tb_debug.settings[TBDebugInfo::setting]
54 #define TB_IF_DEBUG_SETTING(setting, code) if (TB_DEBUG_SETTING(setting)) { code; }
55 
56 #else // TB_RUNTIME_DEBUG_INFO
57 
59 #define ShowDebugInfoSettingsWindow(root) ((void)0)
60 
61 #define TB_DEBUG_SETTING(setting) false
62 #define TB_IF_DEBUG_SETTING(setting, code)
63 
64 #endif // TB_RUNTIME_DEBUG_INFO
65 
66 } // namespace tb
67 
68 #if defined(TB_RUNTIME_DEBUG_INFO)
69 
70 namespace tb { class TBStr; }
71 void TBDebugOut(const tb::TBStr & str);
72 #define TBDebugPrint(...) do { \
73  tb::TBStr tmpxxx; \
74  tmpxxx.SetFormatted(__VA_ARGS__); \
75  TBDebugOut(tmpxxx); \
76  } while (0)
77 
78 #else
79 
80 #define TBDebugOut(str) do { } while (0)
81 #define TBDebugPrint(...) do { } while (0)
82 
83 #endif // TB_RUNTIME_DEBUG_INFO
84 
85 #endif // TB_DEBUG_H
TBStr is a simple string class.
Definition: tb_str.h:62