mirror of
https://github.com/ocornut/imgui.git
synced 2026-03-19 07:08:18 +00:00
Examples: SDL2+WebGPU: fixes hi-dpi handling. (#9300)
This commit is contained in:
@@ -136,6 +136,7 @@ Other Changes:
|
||||
to allocate one. (#8677) [@micb25]
|
||||
- WebGPU: fixed undefined behaviors in example code for requesting adapter
|
||||
and device. (#9246, #9256) [@r-lyeh]
|
||||
- SDL2+WebGPU: fixed hi-dpi handling. (#9300) [@ypujante]
|
||||
- GLFW/SDL2/SDL3+WebGPU: removed suport for Emscripten <4.0.10. (#9281) [@ypujante]
|
||||
|
||||
|
||||
|
||||
@@ -53,7 +53,7 @@ int main(int, char**)
|
||||
|
||||
// Create window with graphics context
|
||||
float main_scale = ImGui_ImplSDL2_GetContentScaleForDisplay(0);
|
||||
SDL_WindowFlags window_flags = SDL_WINDOW_RESIZABLE;
|
||||
SDL_WindowFlags window_flags = (SDL_WindowFlags)(SDL_WINDOW_RESIZABLE | SDL_WINDOW_ALLOW_HIGHDPI);
|
||||
SDL_Window* window = SDL_CreateWindow("Dear ImGui SDL2+WebGPU example", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, wgpu_surface_width, wgpu_surface_height, window_flags);
|
||||
if (window == nullptr)
|
||||
{
|
||||
@@ -143,7 +143,7 @@ int main(int, char**)
|
||||
|
||||
// React to changes in screen size
|
||||
int width, height;
|
||||
SDL_GetWindowSize(window, &width, &height);
|
||||
SDL_GetWindowSizeInPixels(window, &width, &height);
|
||||
if (width != wgpu_surface_width || height != wgpu_surface_height)
|
||||
ResizeSurface(width, height);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user