-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathGuiBase.cpp
More file actions
66 lines (53 loc) · 1.12 KB
/
Copy pathGuiBase.cpp
File metadata and controls
66 lines (53 loc) · 1.12 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
#include "pch.h"
#include "GuiBase.h"
std::string SettingsWindowBase::GetPluginName()
{
return "trnslt";
}
void SettingsWindowBase::SetImGuiContext(uintptr_t ctx)
{
ImGui::SetCurrentContext(reinterpret_cast<ImGuiContext*>(ctx));
}
std::string PluginWindowBase::GetMenuName()
{
return "trnslt";
}
std::string PluginWindowBase::GetMenuTitle()
{
return menuTitle_;
}
void PluginWindowBase::SetImGuiContext(uintptr_t ctx)
{
ImGui::SetCurrentContext(reinterpret_cast<ImGuiContext*>(ctx));
}
bool PluginWindowBase::ShouldBlockInput()
{
return ImGui::GetIO().WantCaptureMouse || ImGui::GetIO().WantCaptureKeyboard;
}
bool PluginWindowBase::IsActiveOverlay()
{
return true;
}
void PluginWindowBase::OnOpen()
{
isWindowOpen_ = true;
}
void PluginWindowBase::OnClose()
{
isWindowOpen_ = false;
}
void PluginWindowBase::Render()
{
if (!ImGui::Begin(menuTitle_.c_str(), &isWindowOpen_, ImGuiWindowFlags_None))
{
// Early out if the window is collapsed, as an optimization.
ImGui::End();
return;
}
RenderWindow();
ImGui::End();
if (!isWindowOpen_)
{
_globalCvarManager->executeCommand("togglemenu " + GetMenuName());
}
}