-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathImguiManager.cpp
More file actions
67 lines (53 loc) · 1.37 KB
/
ImguiManager.cpp
File metadata and controls
67 lines (53 loc) · 1.37 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#include "CommonD.h"
#include "ImguiManager.h"
#include "imgui/backends/imgui_impl_rw.h"
#include "imgui/backends/imgui_impl_dx9.h"
#include "imgui/backends/imgui_impl_win32.h"
#include "imgui/imgui_internal.h"
#define USE_RWIM3D
void ImguiManager::Initialize()
{
// Setup Dear ImGui context
IMGUI_CHECKVERSION();
ImGui::CreateContext();
ImGuiIO& io = ImGui::GetIO(); (void)io;
io.ConfigFlags |= ImGuiConfigFlags_NavEnableKeyboard; // Enable Keyboard Controls
io.ConfigFlags |= ImGuiConfigFlags_NavEnableGamepad; // Enable Gamepad Controls
// Setup Dear ImGui style
ImGui::StyleColorsDark();
//ImGui::StyleColorsClassic();
ImGui::GetIO().MouseDrawCursor = true;
ImGui::GetIO().ConfigWindowsMoveFromTitleBarOnly = true;
ImGui_ImplWin32_Init(*(HWND*)0x00C8CF88);
#ifndef USE_RWIM3D
ImGui_ImplDX9_Init(RwD3DDevice);
#endif // USE_RW_IMGUI
}
void ImguiManager::Release()
{
#ifndef USE_RWIM3D
ImGui_ImplDX9_Shutdown();
#endif // USE_RW_IMGUI
}
void ImguiManager::Render()
{}
void ImguiManager::Bind()
{
ImGui_ImplWin32_NewFrame();
#ifdef USE_RWIM3D
ImGui_ImplRW_NewFrame();
#else
ImGui_ImplDX9_NewFrame();
#endif // USE_RWIM3D
ImGui::NewFrame();
}
void ImguiManager::Unbind()
{
ImGui::EndFrame();
ImGui::Render();
#ifdef USE_RWIM3D
ImGui_ImplRW_RenderDrawData(ImGui::GetDrawData());
#else
ImGui_ImplDX9_RenderDrawData(ImGui::GetDrawData());
#endif // USE_RWIM3D
}