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
23{
24 bool* show;
25 std::function<void()> func;
26};
27
29{
30public:
33
34 bool Initialize(HWND hwnd, ID3D11Device* device, ID3D11DeviceContext* deviceContext);
35 void Shutdown();
36 void Render();
37 void NewFrame();
38 void SetupDockspace();
39
40 // Widgets
41 void WidgetSpeedSlider(float* speed);
42 void WidgetButton();
43 void WidgetFPS();
44 void WidgetAddObject();
45
46 void WidgetObjectWindow();
47 void WidgetTerrainWindow();
48 void WidgetLightWindow();
49 void WidgetEngineSettingsWindow();
50 void WidgetRenderWindow(ImVec2 availableSize);
51 void WidgetLogWindow();
52 void WidgetRenderStats();
53
54 bool ImGuiWidgetRenderer();
55
56 void SetWindowSize(ImVec2 size) { windowSize = size; }
57 ImVec2 GetWindowSize() const { return windowSize; }
58
59 // Getters
60 void SetApp(std::shared_ptr<application_class> app) { app_ = app; }
61
62 // Shader toggles
63
64 bool m_EnableCelShading;
65
66private:
67
68 // --------------------------------------------- //
69 // ----------------- Functions ----------------- //
70 // --------------------------------------------- //
71
72 // --------------------------------------------- //
73 // ----------------- Variables ----------------- //
74 // --------------------------------------------- //
75
76 std::vector<widget_entry> widgets_;
77
78 std::shared_ptr<application_class> app_;
79 scene_manager* scene_manager_;
80 stats* stats_;
81
82 bool showObjectWindow;
83 bool showTerrainWindow;
84 bool showLightWindow;
85 bool showOldSceneWindow;
86 bool showEngineSettingsWindow;
87 bool showLogWindow;
88 bool showStatsWindow;
89
90 int m_SideCount = 0;
91
92 static const int FRAME_HISTORY_COUNT = 3600; // 1min secondes à 60 FPS
93 float m_frameTimeHistory[FRAME_HISTORY_COUNT] = {};
94 int m_frameTimeHistoryIndex = 0;
95
96 bool m_isPhyiscsEnabled = false;
97 bool m_isGravityEnabled = false;
98
99 ImGuiIO* io;
100
101 ID3D11Device* m_device;
102 ID3D11DeviceContext* m_deviceContext;
103 ImVec2 windowSize;
104
105 render_texture_class* m_renderTexture;
106
107 const std::deque<Logger::LogEntry>& logBuffer = Logger::Get().GetLogBuffer();
108
109 int current_fps_, min_fps_, max_fps_, draw_calls_, visible_triangle_count_;
110 float current_frame_time_, min_frame_time_, max_frame_time_ ;
111
112 std::shared_ptr<int> total_vertex_count_;
113 std::shared_ptr<int> total_triangle_count_;
114
115 // gpu information
116 char card_name_[128];
117 int video_memory_ = 0;
118
119 // cpu information
120 std::string cpu_name_;
121 std::string version_driver_;
122};
123
124#endif
Definition stats.h:13