mirror of https://github.com/AxioDL/metaforce.git
aurora: imgui scale change fixes
This commit is contained in:
parent
1583248896
commit
594921789c
|
@ -73,6 +73,9 @@ static bool poll_events() noexcept {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (size.scale != g_windowSize.scale) {
|
if (size.scale != g_windowSize.scale) {
|
||||||
|
if (g_windowSize.scale > 0.f) {
|
||||||
|
Log.report(logvisor::Info, FMT_STRING("Display scale changed to {}"), size.scale);
|
||||||
|
}
|
||||||
g_AppDelegate->onAppDisplayScaleChanged(size.scale);
|
g_AppDelegate->onAppDisplayScaleChanged(size.scale);
|
||||||
}
|
}
|
||||||
g_windowSize = size;
|
g_windowSize = size;
|
||||||
|
|
|
@ -52,11 +52,18 @@ void process_event(const SDL_Event& event) noexcept {
|
||||||
}
|
}
|
||||||
|
|
||||||
void new_frame(const WindowSize& size) noexcept {
|
void new_frame(const WindowSize& size) noexcept {
|
||||||
|
if (g_scale != size.scale) {
|
||||||
|
if (g_scale > 0.f) {
|
||||||
|
// TODO wgpu backend bug: doesn't clear bind groups on invalidate
|
||||||
|
g_resources.ImageBindGroups.Clear();
|
||||||
|
ImGui_ImplWGPU_CreateDeviceObjects();
|
||||||
|
}
|
||||||
|
g_scale = size.scale;
|
||||||
|
}
|
||||||
ImGui_ImplWGPU_NewFrame();
|
ImGui_ImplWGPU_NewFrame();
|
||||||
ImGui_ImplSDL2_NewFrame();
|
ImGui_ImplSDL2_NewFrame();
|
||||||
|
|
||||||
// Render at full DPI
|
// Render at full DPI
|
||||||
g_scale = size.scale;
|
|
||||||
ImGui::GetIO().DisplaySize = ImVec2{static_cast<float>(size.fb_width), static_cast<float>(size.fb_height)};
|
ImGui::GetIO().DisplaySize = ImVec2{static_cast<float>(size.fb_width), static_cast<float>(size.fb_height)};
|
||||||
ImGui::NewFrame();
|
ImGui::NewFrame();
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,6 +29,7 @@ ImTextureID ImGuiEngine::metaforceIcon;
|
||||||
void ImGuiEngine_Initialize(float scale) {
|
void ImGuiEngine_Initialize(float scale) {
|
||||||
ImGui::GetCurrentContext();
|
ImGui::GetCurrentContext();
|
||||||
ImGuiIO& io = ImGui::GetIO();
|
ImGuiIO& io = ImGui::GetIO();
|
||||||
|
io.Fonts->Clear();
|
||||||
|
|
||||||
auto* fontData = new uint8_t[NOTO_MONO_FONT_DECOMPRESSED_SZ];
|
auto* fontData = new uint8_t[NOTO_MONO_FONT_DECOMPRESSED_SZ];
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue