Khaotic Engine Reborn
Loading...
Searching...
No Matches
imguiManager.h
1#pragma once
2#ifndef _IMGUI_MANAGER_H_
3#define _IMGUI_MANAGER_H_
4
5#include "Logger.h"
6#include "sceneManager.h"
7#include "fps_limiter.h"
8
9#include <imgui.h>
10#include <imgui_impl_dx11.h>
11#include <imgui_impl_win32.h>
12#include <windows.h>
13#include <deque>
14#include <functional>
15
16#include "render_texture_class.h"
17#include "scene_manager.h"
18
20class stats;
21
28{
29 bool* show;
30 std::function<void()> func;
31};
32
34{
35public:
36
43
51 bool Initialize(HWND hwnd, ID3D11Device* device, ID3D11DeviceContext* deviceContext);
55 void Shutdown();
59 void Render();
63 void NewFrame();
68 void SetupDockspace();
69
70 // Widgets
75 void WidgetSpeedSlider(float* speed);
79 void WidgetButton();
83 void WidgetFPS();
87 void WidgetAddObject();
88
92 void WidgetObjectWindow();
100 void WidgetLightWindow();
109 void WidgetRenderWindow(ImVec2 availableSize);
113 void WidgetLogWindow();
119 void WidgetRenderStats();
125 bool ImGuiWidgetRenderer();
126
131 void SetWindowSize(ImVec2 size) { windowSize = size; }
136 ImVec2 GetWindowSize() const { return windowSize; }
137
142 void SetApp(std::shared_ptr<application_class> app) { app_ = app; }
143
144 // Shader toggles
145
146 bool m_EnableCelShading;
147
148private:
149
150 // --------------------------------------------- //
151 // ----------------- Functions ----------------- //
152 // --------------------------------------------- //
153
154 // --------------------------------------------- //
155 // ----------------- Variables ----------------- //
156 // --------------------------------------------- //
157
158 std::vector<widget_entry> widgets_;
159
160 std::shared_ptr<application_class> app_;
161 scene_manager* scene_manager_;
162 stats* stats_;
163
164 bool showObjectWindow;
165 bool showTerrainWindow;
166 bool showLightWindow;
167 bool showOldSceneWindow;
168 bool showEngineSettingsWindow;
169 bool showLogWindow;
170 bool showStatsWindow;
171
172 int m_SideCount = 0;
173
174 static const int FRAME_HISTORY_COUNT = 3600; // 1min secondes à 60 FPS
175 float m_frameTimeHistory[FRAME_HISTORY_COUNT] = {};
176 int m_frameTimeHistoryIndex = 0;
177
178 bool m_isPhyiscsEnabled = false;
179 bool m_isGravityEnabled = false;
180
181 ImGuiIO* io;
182
183 ID3D11Device* m_device;
184 ID3D11DeviceContext* m_deviceContext;
185 ImVec2 windowSize;
186
187 render_texture_class* m_renderTexture;
188
189 const std::deque<Logger::LogEntry>& logBuffer = Logger::Get().GetLogBuffer();
190
191 int current_fps_, min_fps_, max_fps_, draw_calls_, visible_triangle_count_;
192 float current_frame_time_, min_frame_time_, max_frame_time_ ;
193
194 std::shared_ptr<int> total_vertex_count_;
195 std::shared_ptr<int> total_triangle_count_;
196
197 // gpu information
198 char card_name_[128];
199 int video_memory_ = 0;
200
201 // cpu information
202 std::string cpu_name_;
203 std::string version_driver_;
204};
205
206#endif
static Logger & Get()
Definition Logger.h:20
const std::deque< LogEntry > & GetLogBuffer() const
Definition Logger.h:220
void WidgetObjectWindow()
void SetupDockspace()
void WidgetLightWindow()
bool Initialize(HWND hwnd, ID3D11Device *device, ID3D11DeviceContext *deviceContext)
void WidgetEngineSettingsWindow()
void WidgetAddObject()
void SetWindowSize(ImVec2 size)
ImVec2 GetWindowSize() const
void SetApp(std::shared_ptr< application_class > app)
void WidgetFPS()
void WidgetTerrainWindow()
void WidgetRenderWindow(ImVec2 availableSize)
void WidgetLogWindow()
bool ImGuiWidgetRenderer()
void WidgetRenderStats()
void WidgetSpeedSlider(float *speed)
Definition stats.h:13