Blamite Game Engine - Blam (Core)
stats.hpp
Go to the documentation of this file.
1 #pragma once
2 
3 #include "../../debug_ui.h"
4 
6 
8 {
24  {
25  private:
26  bool show_fps = false;
27 
28  public:
32  Stats() {};
33 
37  ~Stats() {};
38 
44  bool* ShowFPS()
45  {
46  return &show_fps;
47  }
48 
52  void Draw()
53  {
54  //Info box stuff starts here
55 
56  int box_x = 10;
57  int box_y = 30;
58  ImVec2 window_location(box_x, box_y);
59  ImVec2 window_location_offset(box_x + 1.6, box_y + 1.0);
60 
61  ImVec2 window_size(3000, 1000);
62 
63  ImGui::SetNextWindowPos(window_location_offset);
64  ImGui::SetNextWindowSize(window_size);
65  ImGui::Begin("stats_shadow", &show, window_size, 0.0f, ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoSavedSettings | ImGuiWindowFlags_NoInputs);
66  /*ImGui::Text("Simple overlay\non the top-left side of the screen.");
67  ImGui::Separator();*/
68  ImGui::PushStyleColor(ImGuiCol_Text, InternalUI::Colors::console_shadow());
69  if (show)
70  {
71  ImGui::Text("mouse pos: (%.1f,%.1f)", ImGui::GetIO().MousePos.x, ImGui::GetIO().MousePos.y);
72  }
73  if (show_fps)
74  {
75  ImGui::Text("%.3f ms/frame", 1000.0f / ImGui::GetIO().Framerate);
76  ImGui::Text("fps: %.1f FPS", ImGui::GetIO().Framerate);
77  }
78 
79 
80 
81  DXGI_SWAP_CHAIN_DESC sd;
83  LPTSTR window_title = NULL;
84  GetWindowText(sd.OutputWindow, window_title, 255);
85 
86  if (show)
87  {
88  ImGui::Text("DXGI_SWAP_CHAIN_DESC:");
89  ImGui::Text(" buffer_count: %s", std::to_string(sd.BufferCount).c_str());
90  ImGui::Text(" buffer_desc: ");
91  ImGui::Text(" format: %s", std::to_string(sd.BufferDesc.Format).c_str());
92  ImGui::Text(" refresh_rate: %s/%s", std::to_string(sd.BufferDesc.RefreshRate.Denominator).c_str(), std::to_string(sd.BufferDesc.RefreshRate.Numerator).c_str());
93  ImGui::Text(" scaling: %s", std::to_string(sd.BufferDesc.Scaling).c_str());
94  ImGui::Text(" scanline_ordering: %s", std::to_string(sd.BufferDesc.ScanlineOrdering).c_str());
95  ImGui::Text(" resolution: %sx%s", std::to_string(sd.BufferDesc.Height).c_str(), std::to_string(sd.BufferDesc.Width).c_str());
96  ImGui::Text(" buffer_usage: %s", std::to_string(sd.BufferUsage).c_str());
97  ImGui::Text(" flags: %s", std::to_string(sd.Flags).c_str());
98  ImGui::Text(" output_window: %s", window_title);
99  ImGui::Text(" sample_desc: ");
100  ImGui::Text(" count: %s", std::to_string(sd.SampleDesc.Count).c_str());
101  ImGui::Text(" quality: %s", std::to_string(sd.SampleDesc.Quality).c_str());
102  ImGui::Text(" swap_effect: %s", std::to_string(sd.SwapEffect).c_str());
103  ImGui::Text(" windowed: %s", std::to_string(sd.Windowed).c_str());
104  }
105 
106  //ImGui::Text("Window location: (%.1f,%.1f)", window_location);
107  //ImGui::Text("Window size: (%.1f,%.1f)", window_location);
108  ImGui::PopStyleColor();
109  ImGui::End();
110 
111 
112  ImGui::SetNextWindowPos(window_location);
113  ImGui::SetNextWindowSize(window_size);
114  ImGui::Begin("Example: Fixed Overlay", &show, window_size, 0.0f, ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoSavedSettings | ImGuiWindowFlags_NoInputs);
115  /*ImGui::Text("Simple overlay\non the top-left side of the screen.");
116  ImGui::Separator();*/
117  if (show)
118  {
119  ImGui::Text("mouse pos: (%.1f,%.1f)", ImGui::GetIO().MousePos.x, ImGui::GetIO().MousePos.y);
120  }
121  if (show_fps)
122  {
123  ImGui::Text("%.3f ms/frame", 1000.0f / ImGui::GetIO().Framerate);
124  ImGui::Text("fps: %.1f FPS", ImGui::GetIO().Framerate);
125  }
126 
127  //DXGI_SWAP_CHAIN_DESC sd;
128  //Blam::dx_swapchain()->GetDesc(&sd);
129  //LPTSTR window_title = NULL;
130  //GetWindowText(sd.OutputWindow, window_title, 255);
131 
132  if (show)
133  {
134  ImGui::Text("DXGI_SWAP_CHAIN_DESC:");
135  ImGui::Text(" buffer_count: %s", std::to_string(sd.BufferCount).c_str());
136  ImGui::Text(" buffer_desc: ");
137  ImGui::Text(" format: %s", std::to_string(sd.BufferDesc.Format).c_str());
138  ImGui::Text(" refresh_rate: %s/%s", std::to_string(sd.BufferDesc.RefreshRate.Denominator).c_str(), std::to_string(sd.BufferDesc.RefreshRate.Numerator).c_str());
139  ImGui::Text(" scaling: %s", std::to_string(sd.BufferDesc.Scaling).c_str());
140  ImGui::Text(" scanline_ordering: %s", std::to_string(sd.BufferDesc.ScanlineOrdering).c_str());
141  ImGui::Text(" resolution: %sx%s", std::to_string(sd.BufferDesc.Height).c_str(), std::to_string(sd.BufferDesc.Width).c_str());
142  ImGui::Text(" buffer_usage: %s", std::to_string(sd.BufferUsage).c_str());
143  ImGui::Text(" flags: %s", std::to_string(sd.Flags).c_str());
144  ImGui::Text(" output_window: %s", window_title);
145  ImGui::Text(" sample_desc: ");
146  ImGui::Text(" count: %s", std::to_string(sd.SampleDesc.Count).c_str());
147  ImGui::Text(" quality: %s", std::to_string(sd.SampleDesc.Quality).c_str());
148  ImGui::Text(" swap_effect: %s", std::to_string(sd.SwapEffect).c_str());
149  ImGui::Text(" windowed: %s", std::to_string(sd.Windowed).c_str());
150  }
151 
152  //ImGui::Text("Window location: (%.1f,%.1f)", window_location);
153  //ImGui::Text("Window size: (%.1f,%.1f)", window_location);
154  ImGui::End();
155 
156  //Info box stuff ends here
157  }
158  };
159 }
Blam::DebugUI::Windows::Stats::ShowFPS
bool * ShowFPS()
Retrieves whether or not the FPS should be shown in the stats display.
Definition: stats.hpp:44
rendering.h
Blam::DebugUI::Windows::Stats::Stats
Stats()
Empty constructor.
Definition: stats.hpp:32
Blam::DebugUI::Windows::Stats::~Stats
~Stats()
Empty destructor.
Definition: stats.hpp:37
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:441
InternalUI::Colors::console_shadow
UI_API ImVec4 console_shadow()
Definition: debug_ui_colors.cpp:126
Blam::DebugUI::ImGUIDrawingGroup
Class representing an ImGUI drawing group/draw list item.
Definition: debug_ui.h:408
BlamRendering::DirectX::GetDXGISwapChain
BLAM IDXGISwapChain * GetDXGISwapChain()
Retrieves the current DXGI Swap Chain.
Definition: render_manage.cpp:577
Blam::DebugUI::Windows::Stats
This is the ImGUI-based implementation of the stats widget.
Definition: stats.hpp:23
Blam::DebugUI::Windows
Legacy namespace to contain data for the legacy ImGUI console.
Definition: debug_ui.h:493
Text
@ Text
Master text object that wraps around both BitmapText and DWText.
Definition: render_stack.h:73
Blam::DebugUI::Windows::Stats::Draw
void Draw()
Draws the stats display.
Definition: stats.hpp:52