Blamite Game Engine - blam!  00296.01.12.21.0102.blamite
The core library for the Blamite Game Engine.
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 = true;
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 
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 
107  //ImGui::Text("Window location: (%.1f,%.1f)", window_location);
108  //ImGui::Text("Window size: (%.1f,%.1f)", window_location);
109  ImGui::PopStyleColor();
110  ImGui::End();
111 
112 
113  ImGui::SetNextWindowPos(window_location);
114  ImGui::SetNextWindowSize(window_size);
115  ImGui::Begin("Example: Fixed Overlay", &show, window_size, 0.0f, ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoSavedSettings | ImGuiWindowFlags_NoInputs);
116  /*ImGui::Text("Simple overlay\non the top-left side of the screen.");
117  ImGui::Separator();*/
118  if (show)
119  {
120  ImGui::Text("mouse pos: (%.1f,%.1f)", ImGui::GetIO().MousePos.x, ImGui::GetIO().MousePos.y);
121  }
122  if (show_fps)
123  {
124  ImGui::Text("%.3f ms/frame", 1000.0f / ImGui::GetIO().Framerate);
125  ImGui::Text("fps: %.1f FPS", ImGui::GetIO().Framerate);
126  }
127 
128  //DXGI_SWAP_CHAIN_DESC sd;
129  //Blam::dx_swapchain()->GetDesc(&sd);
130  //LPTSTR window_title = NULL;
131  //GetWindowText(sd.OutputWindow, window_title, 255);
132 
134  {
135  DXGI_SWAP_CHAIN_DESC sd;
137  LPTSTR window_title = NULL;
138  GetWindowText(sd.OutputWindow, window_title, 255);
139 
140  if (show)
141  {
142  ImGui::Text("DXGI_SWAP_CHAIN_DESC:");
143  ImGui::Text(" buffer_count: %s", std::to_string(sd.BufferCount).c_str());
144  ImGui::Text(" buffer_desc: ");
145  ImGui::Text(" format: %s", std::to_string(sd.BufferDesc.Format).c_str());
146  ImGui::Text(" refresh_rate: %s/%s", std::to_string(sd.BufferDesc.RefreshRate.Denominator).c_str(), std::to_string(sd.BufferDesc.RefreshRate.Numerator).c_str());
147  ImGui::Text(" scaling: %s", std::to_string(sd.BufferDesc.Scaling).c_str());
148  ImGui::Text(" scanline_ordering: %s", std::to_string(sd.BufferDesc.ScanlineOrdering).c_str());
149  ImGui::Text(" resolution: %sx%s", std::to_string(sd.BufferDesc.Height).c_str(), std::to_string(sd.BufferDesc.Width).c_str());
150  ImGui::Text(" buffer_usage: %s", std::to_string(sd.BufferUsage).c_str());
151  ImGui::Text(" flags: %s", std::to_string(sd.Flags).c_str());
152  ImGui::Text(" output_window: %s", window_title);
153  ImGui::Text(" sample_desc: ");
154  ImGui::Text(" count: %s", std::to_string(sd.SampleDesc.Count).c_str());
155  ImGui::Text(" quality: %s", std::to_string(sd.SampleDesc.Quality).c_str());
156  ImGui::Text(" swap_effect: %s", std::to_string(sd.SwapEffect).c_str());
157  ImGui::Text(" windowed: %s", std::to_string(sd.Windowed).c_str());
158  }
159  }
160 
161  //ImGui::Text("Window location: (%.1f,%.1f)", window_location);
162  //ImGui::Text("Window size: (%.1f,%.1f)", window_location);
163  ImGui::End();
164 
165  //Info box stuff ends here
166  }
167  };
168 }
BlamRendering::GetCurrentRenderingEngine
BLAM BlamRenderingEngine GetCurrentRenderingEngine()
Retrieves the current rendering engine being used.
Definition: rendering_abstraction.cpp:103
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:362
InternalUI::Colors::console_shadow
UI_API ImVec4 console_shadow()
Definition: debug_ui_colors.cpp:29
Blam::DebugUI::ImGUIDrawingGroup
Class representing an ImGUI drawing group/draw list item.
Definition: debug_ui.h:359
BlamRendering::DirectX::GetDXGISwapChain
BLAM IDXGISwapChain * GetDXGISwapChain()
Retrieves the current DXGI Swap Chain.
Definition: render_manage.cpp:588
DirectX11
@ DirectX11
Definition: rendering.h:25
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:434
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