Skip to content

Commit

Permalink
Update high DPI handling
Browse files Browse the repository at this point in the history
  • Loading branch information
MartinHelmut committed Jul 14, 2024
1 parent 6d2aad5 commit 82c84d8
Show file tree
Hide file tree
Showing 6 changed files with 5 additions and 20 deletions.
5 changes: 4 additions & 1 deletion src/core/Core/Application.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -147,9 +147,12 @@ ExitStatus App::Application::run() {
// Rendering
ImGui::Render();

SDL_RenderSetScale(m_window->get_native_renderer(),
io.DisplayFramebufferScale.x,
io.DisplayFramebufferScale.y);
SDL_SetRenderDrawColor(m_window->get_native_renderer(), 100, 100, 100, 255);
SDL_RenderClear(m_window->get_native_renderer());
ImGui_ImplSDLRenderer2_RenderDrawData(ImGui::GetDrawData());
ImGui_ImplSDLRenderer2_RenderDrawData(ImGui::GetDrawData(), m_window->get_native_renderer());
SDL_RenderPresent(m_window->get_native_renderer());
}

Expand Down
1 change: 0 additions & 1 deletion src/core/Core/Window.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ Window::Window(const Settings& settings) {

SDL_RendererInfo info;
SDL_GetRendererInfo(m_renderer, &info);
DPIHandler::set_render_scale(m_renderer);

APP_DEBUG("Current SDL_Renderer: {}", info.name);
}
Expand Down
5 changes: 0 additions & 5 deletions src/core/Platform/Linux/DPIHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,6 @@ WindowSize DPIHandler::get_dpi_aware_window_size(const Window::Settings& setting
return {settings.width, settings.height};
}

void DPIHandler::set_render_scale([[maybe_unused]] SDL_Renderer* renderer) {
APP_PROFILE_FUNCTION();
// do nothing
}

void DPIHandler::set_global_font_scaling([[maybe_unused]] ImGuiIO* io) {
APP_PROFILE_FUNCTION();
// do nothing
Expand Down
7 changes: 0 additions & 7 deletions src/core/Platform/Mac/DPIHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,6 @@ WindowSize DPIHandler::get_dpi_aware_window_size(const Window::Settings& setting
return {settings.width, settings.height};
}

void DPIHandler::set_render_scale(SDL_Renderer* renderer) {
APP_PROFILE_FUNCTION();

auto scale{get_scale()};
SDL_RenderSetScale(renderer, scale, scale);
}

void DPIHandler::set_global_font_scaling(ImGuiIO* io) {
APP_PROFILE_FUNCTION();

Expand Down
5 changes: 0 additions & 5 deletions src/core/Platform/Windows/DPIHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,6 @@ WindowSize DPIHandler::get_dpi_aware_window_size(const Window::Settings& setting
return {width, height};
}

void DPIHandler::set_render_scale([[maybe_unused]] SDL_Renderer* renderer) {
APP_PROFILE_FUNCTION();
// do nothing
}

void DPIHandler::set_global_font_scaling([[maybe_unused]] ImGuiIO* io) {
APP_PROFILE_FUNCTION();
// do nothing
Expand Down
2 changes: 1 addition & 1 deletion vendor/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ FetchContent_Declare(
FetchContent_Declare(
imgui
GIT_REPOSITORY "https://github.com/ocornut/imgui.git"
GIT_TAG 527b2c45af2f8964f95826bd16ab7c7ed372ae41 # Branch: docking, date: 02.07.2024, 19:05 GMT+1
GIT_TAG 527b2c45af2f8964f95826bd16ab7c7ed372ae41 # Branch: docking, date: 02.07.2024, 19:05 GMT+2
)

FetchContent_Declare(
Expand Down

0 comments on commit 82c84d8

Please sign in to comment.