Blamite Game Engine - blam!  00296.01.12.21.0102.blamite
The core library for the Blamite Game Engine.
bgfx_test.hpp
Go to the documentation of this file.
1 #pragma once
2 
3 #include "../../debug_ui.h"
4 
5 #include <bgfx/bgfx.h>
6 
10 
11 namespace Blam::DebugUI::Windows
12 {
21  {
22  private:
23  bool debug_flag_wireframe = false;
24  bool debug_flag_profiler = false;
25  bool debug_flag_stats = false;
26  bool debug_flag_text = false;
27  bool debug_flag_ifh = false;
28 
29  bool clear_flag_color = true;
30  bool clear_flag_depth = true;
31  bool clear_flag_stencil = false;
32  public:
36  void Draw()
37  {
38  if (show)
39  {
40  if (ImGui::Begin("bgfx Testing", &show))
41  {
42  if (ImGui::CollapsingHeader(ENGINE_TEXT("bgfx_test_section_debug_flags_name").c_str()))
43  {
44  ImGui::Checkbox(ENGINE_TEXT("bgfx_debug_flag_wireframe_name").c_str(), &debug_flag_wireframe);
45  ImGui::SameLine();
46  Widgets::ShowHelpMarker(ENGINE_TEXT("bgfx_debug_flag_wireframe_help_text").c_str());
47 
48  ImGui::Checkbox(ENGINE_TEXT("bgfx_debug_flag_profiler_name").c_str(), &debug_flag_profiler);
49  ImGui::SameLine();
50  Widgets::ShowHelpMarker(ENGINE_TEXT("bgfx_debug_flag_profiler_help_text").c_str());
51 
52  ImGui::Checkbox(ENGINE_TEXT("bgfx_debug_flag_stats_name").c_str(), &debug_flag_stats);
53  ImGui::SameLine();
54  Widgets::ShowHelpMarker(ENGINE_TEXT("bgfx_debug_flag_stats_help_text").c_str());
55 
56  ImGui::Checkbox(ENGINE_TEXT("bgfx_debug_flag_text_name").c_str(), &debug_flag_text);
57  ImGui::SameLine();
58  Widgets::ShowHelpMarker(ENGINE_TEXT("bgfx_debug_flag_text_help_text").c_str());
59 
60  ImGui::Checkbox(ENGINE_TEXT("bgfx_debug_flag_ifh_name").c_str(), &debug_flag_ifh);
61  ImGui::SameLine();
62  Widgets::ShowHelpMarker(ENGINE_TEXT("bgfx_debug_flag_ifh_help_text").c_str());
63 
64 
65  int debug_flags = 0;
66 
67  if (debug_flag_wireframe)
68  {
69  debug_flags += BGFX_DEBUG_WIREFRAME;
70  }
71 
72  if (debug_flag_profiler)
73  {
74  debug_flags += BGFX_DEBUG_PROFILER;
75  }
76 
77  if (debug_flag_stats)
78  {
79  debug_flags += BGFX_DEBUG_STATS;
80  }
81 
82  if (debug_flag_text)
83  {
84  debug_flags += BGFX_DEBUG_TEXT;
85  }
86 
87  if (debug_flag_ifh)
88  {
89  debug_flags += BGFX_DEBUG_IFH;
90  }
91 
92  bgfx::setDebug(debug_flags);
93  }
94 
95  if (ImGui::CollapsingHeader(ENGINE_TEXT("bgfx_test_section_clearing_flags_name").c_str()))
96  {
97  ImGui::Checkbox("clear color", &clear_flag_color);
98  ImGui::Checkbox("clear stencil", &clear_flag_stencil);
99  ImGui::Checkbox("clear depth", &clear_flag_depth);
100 
101  int clear_flags = 0;
102 
103  if (clear_flag_color)
104  {
105  clear_flags += BGFX_CLEAR_COLOR;
106  }
107 
108  if (clear_flag_stencil)
109  {
110  clear_flags += BGFX_CLEAR_STENCIL;
111  }
112 
113  if (clear_flag_depth)
114  {
115  clear_flags += BGFX_CLEAR_DEPTH;
116  }
117 
119  }
120 
121  if (ImGui::CollapsingHeader(ENGINE_TEXT("bgfx_test_section_projection_name").c_str()))
122  {
123  ImGui::Text(ENGINE_TEXT("bgfx_projection_help_text").c_str());
124  }
125  }
126  ImGui::End();
127  }
128  }
129  };
130 }
Blam::DebugUI::Widgets::ShowHelpMarker
BLAM void ShowHelpMarker(const char *desc)
Shows a help indicator.
Definition: widgets.cpp:7
BlamRendering::BGFX::SetViewClearFlags
BLAM void SetViewClearFlags(int new_flags)
Definition: bgfx.cpp:137
engine_text.h
rendering.h
widgets.h
Blam::DebugUI::ImGUIDrawingGroup::show
bool show
Controls whether or not the group should be shown. May not be used in all groups.
Definition: debug_ui.h:362
Blam::DebugUI::ImGUIDrawingGroup
Class representing an ImGUI drawing group/draw list item.
Definition: debug_ui.h:359
Blam::DebugUI::Windows::bgfxTest
Dialog used to test basic bgfx features.
Definition: bgfx_test.hpp:20
ENGINE_TEXT
#define ENGINE_TEXT(string_id)
Definition: engine_text.h:7
Blam::DebugUI::Windows
Legacy namespace to contain data for the legacy ImGUI console.
Definition: debug_ui.h:434
Text
@ Text
Master text object that wraps around both BitmapText and DWText.
Definition: render_stack.h:73
Blam::DebugUI::Windows::bgfxTest::Draw
void Draw()
Draws the window and any Direct2D primitives that have been enabled.
Definition: bgfx_test.hpp:36