Elaztek Developer Hub
Blamite Game Engine - blam!  00406.12.10.23.1457.blamite
The core library for the Blamite Game Engine.
stats.hpp
Go to the documentation of this file.
1 #pragma once
2 
4 
7 
22 {
23 private:
24  bool show_fps = false;
25 
26 public:
32  bool* ShowFPS()
33  {
34  return &show_fps;
35  }
36 
40  void Draw()
41  {
42  //Info box stuff starts here
43 
44  int box_x = 10;
45  int box_y = 30;
46  ImVec2 window_location(box_x, box_y);
47  ImVec2 window_location_offset(box_x + 1.6, box_y + 1.0);
48 
49  ImVec2 window_size(3000, 1000);
50 
51  ImGui::SetNextWindowPos(window_location_offset);
52  ImGui::SetNextWindowSize(window_size);
54  /*ImGui::Text("Simple overlay\non the top-left side of the screen.");
55  ImGui::Separator();*/
56  BlamVector4 console_shadow_color = Blam::Globals::GetGlobalAsColor("console_shadow")->ToVector4();
57  ImVec4 console_shadow_color_imgui = ImVec4(console_shadow_color.x, console_shadow_color.y, console_shadow_color.z, console_shadow_color.w);
58 
59  ImGui::PushStyleColor(ImGuiCol_Text, console_shadow_color_imgui);
60  if (show)
61  {
62  ImGui::Text("mouse pos: (%.1f,%.1f)", ImGui::GetIO().MousePos.x, ImGui::GetIO().MousePos.y);
63  }
64  if (show_fps)
65  {
66  ImGui::Text("%.3f ms/frame", 1000.0f / ImGui::GetIO().Framerate);
67  ImGui::Text("fps: %.1f FPS", ImGui::GetIO().Framerate);
68  }
69 
70  //ImGui::Text("Window location: (%.1f,%.1f)", window_location);
71  //ImGui::Text("Window size: (%.1f,%.1f)", window_location);
73  ImGui::End();
74 
75 
76  ImGui::SetNextWindowPos(window_location);
77  ImGui::SetNextWindowSize(window_size);
79  /*ImGui::Text("Simple overlay\non the top-left side of the screen.");
80  ImGui::Separator();*/
81  if (show)
82  {
83  ImGui::Text("mouse pos: (%.1f,%.1f)", ImGui::GetIO().MousePos.x, ImGui::GetIO().MousePos.y);
84  }
85  if (show_fps)
86  {
87  ImGui::Text("%.3f ms/frame", 1000.0f / ImGui::GetIO().Framerate);
88  ImGui::Text("fps: %.1f FPS", ImGui::GetIO().Framerate);
89  }
90 
91  //DXGI_SWAP_CHAIN_DESC sd;
92  //Blam::dx_swapchain()->GetDesc(&sd);
93  //LPTSTR window_title = NULL;
94  //GetWindowText(sd.OutputWindow, window_title, 255);
95 
96  //ImGui::Text("Window location: (%.1f,%.1f)", window_location);
97  //ImGui::Text("Window size: (%.1f,%.1f)", window_location);
98  ImGui::End();
99 
100  //Info box stuff ends here
101  }
102 };
BlamImGuiWindow::show
bool show
Controls whether or not the group should be shown. May not be used in all groups.
Definition: imgui.h:34
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
ImVec4
Definition: imgui.h:192
ImGui::End
IMGUI_API void End()
Definition: imgui.cpp:6016
ImGuiWindowFlags_NoSavedSettings
@ ImGuiWindowFlags_NoSavedSettings
Definition: imgui.h:722
rendering.h
BlamImGuiWindow
Class representing an ImGUI window.
Definition: imgui.h:31
ImVec2
Definition: imgui.h:179
Blam::Globals::GetGlobalAsColor
BLAM BlamColor * GetGlobalAsColor(std::string name)
Retrieves a global's value as a BlamColor.
Definition: globals.cpp:415
BlamImGuiWindow_Stats
This is the ImGUI-based implementation of the stats widget.
Definition: stats.hpp:21
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
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
globals.h
ImGui::SetNextWindowSize
IMGUI_API void SetNextWindowSize(const ImVec2 &size, ImGuiCond cond=0)
Definition: imgui.cpp:6741
BlamImGuiWindow_Stats::ShowFPS
bool * ShowFPS()
Retrieves whether or not the FPS should be shown in the stats display.
Definition: stats.hpp:32
ImVec2::y
float y
Definition: imgui.h:181
ImGuiWindowFlags_NoMove
@ ImGuiWindowFlags_NoMove
Definition: imgui.h:716
ImGuiCol_Text
@ ImGuiCol_Text
Definition: imgui.h:1027
imgui.h
ImGuiWindowFlags_NoResize
@ ImGuiWindowFlags_NoResize
Definition: imgui.h:715
BlamImGuiWindow_Stats::Draw
void Draw()
Draws the stats display.
Definition: stats.hpp:40
ImGui::PushStyleColor
IMGUI_API void PushStyleColor(ImGuiCol idx, ImU32 col)
Definition: imgui.cpp:6321