mirror of
https://github.com/cemu-project/Cemu.git
synced 2025-07-04 14:01:17 +12:00
Separate imgui contexts for TV and Pad windows. (#664)
This commit is contained in:
parent
daf3ef060a
commit
cbb79fd34c
8 changed files with 131 additions and 184 deletions
|
@ -37,6 +37,34 @@ bool Renderer::GetVRAMInfo(int& usageInMB, int& totalInMB) const
|
|||
return false;
|
||||
}
|
||||
|
||||
|
||||
void Renderer::Initialize()
|
||||
{
|
||||
// imgui
|
||||
imguiFontAtlas = new ImFontAtlas();
|
||||
imguiFontAtlas->AddFontDefault();
|
||||
|
||||
auto setupContext = [](ImGuiContext* context){
|
||||
ImGui::SetCurrentContext(context);
|
||||
ImGuiIO& io = ImGui::GetIO();
|
||||
io.WantSaveIniSettings = false;
|
||||
io.IniFilename = nullptr;
|
||||
};
|
||||
|
||||
imguiTVContext = ImGui::CreateContext(imguiFontAtlas);
|
||||
imguiPadContext = ImGui::CreateContext(imguiFontAtlas);
|
||||
setupContext(imguiTVContext);
|
||||
setupContext(imguiPadContext);
|
||||
}
|
||||
|
||||
void Renderer::Shutdown()
|
||||
{
|
||||
// imgui
|
||||
ImGui::DestroyContext(imguiTVContext);
|
||||
ImGui::DestroyContext(imguiPadContext);
|
||||
delete imguiFontAtlas;
|
||||
}
|
||||
|
||||
bool Renderer::ImguiBegin(bool mainWindow)
|
||||
{
|
||||
sint32 w = 0, h = 0;
|
||||
|
@ -50,6 +78,9 @@ bool Renderer::ImguiBegin(bool mainWindow)
|
|||
if (w == 0 || h == 0)
|
||||
return false;
|
||||
|
||||
// select the right context
|
||||
ImGui::SetCurrentContext(mainWindow ? imguiTVContext : imguiPadContext);
|
||||
|
||||
const Vector2f window_size{ (float)w,(float)h };
|
||||
auto& io = ImGui::GetIO();
|
||||
io.DisplaySize = { window_size.x, window_size.y }; // should be only updated in the renderer and only when needed
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue