Elaztek Developer Hub
Blamite Game Engine - blam!  00346.12.11.21.0529.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);
66  /*ImGui::Text("Simple overlay\non the top-left side of the screen.");
67  ImGui::Separator();*/
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);
110  ImGui::End();
111 
112 
113  ImGui::SetNextWindowPos(window_location);
114  ImGui::SetNextWindowSize(window_size);
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
ImGuiIO::MousePos
ImVec2 MousePos
Definition: imgui.h:1409
ImGuiWindowFlags_NoTitleBar
@ ImGuiWindowFlags_NoTitleBar
Definition: imgui.h:714
ImGui::PopStyleColor
IMGUI_API void PopStyleColor(int count=1)
Definition: imgui.cpp:6341
ImGui::End
IMGUI_API void End()
Definition: imgui.cpp:6016
ImGuiWindowFlags_NoSavedSettings
@ ImGuiWindowFlags_NoSavedSettings
Definition: imgui.h:722
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
ImVec2
Definition: imgui.h:179
ImGui::Begin
IMGUI_API bool Begin(const char *name, bool *p_open=NULL, ImGuiWindowFlags flags=0)
Definition: imgui.cpp:5397
ImGuiWindowFlags_NoInputs
@ ImGuiWindowFlags_NoInputs
Definition: imgui.h:736
NULL
Add a fourth parameter to bake specific font ranges NULL
Definition: README.txt:57
ImGui::Text
IMGUI_API void Text(const char *fmt,...) IM_FMTARGS(1)
Definition: imgui_widgets.cpp:238
ImGui::GetIO
IMGUI_API ImGuiIO & GetIO()
Definition: imgui.cpp:3300
ImGui::SetNextWindowPos
IMGUI_API void SetNextWindowPos(const ImVec2 &pos, ImGuiCond cond=0, const ImVec2 &pivot=ImVec2(0, 0))
Definition: imgui.cpp:6731
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
ImGui::SetNextWindowSize
IMGUI_API void SetNextWindowSize(const ImVec2 &size, ImGuiCond cond=0)
Definition: imgui.cpp:6741
BlamRendering::DirectX::GetDXGISwapChain
BLAM IDXGISwapChain * GetDXGISwapChain()
Retrieves the current DXGI Swap Chain.
Definition: render_manage.cpp:588
DirectX11
@ DirectX11
Definition: rendering.h:25
ImVec2::y
float y
Definition: imgui.h:181
ImGuiWindowFlags_NoMove
@ ImGuiWindowFlags_NoMove
Definition: imgui.h:716
ImGuiCol_Text
@ ImGuiCol_Text
Definition: imgui.h:1027
Blam::DebugUI::Windows::Stats
This is the ImGUI-based implementation of the stats widget.
Definition: stats.hpp:23
ImGuiWindowFlags_NoResize
@ ImGuiWindowFlags_NoResize
Definition: imgui.h:715
Blam::DebugUI::Windows
Legacy namespace to contain data for the legacy ImGUI console.
Definition: ui.h:14
Blam::DebugUI::Windows::Stats::Draw
void Draw()
Draws the stats display.
Definition: stats.hpp:52
ImGui::PushStyleColor
IMGUI_API void PushStyleColor(ImGuiCol idx, ImU32 col)
Definition: imgui.cpp:6321