Skip to content

Commit a659367

Browse files
committed
Adjust resolution for emscripten device pixel ratio on init
1 parent e8c15ea commit a659367

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

src/platform/sdl/sdl2_ui.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -375,6 +375,11 @@ bool Sdl2Ui::RefreshDisplayMode() {
375375
}
376376

377377
SDL_GetWindowSize(sdl_window, &window.width, &window.height);
378+
#ifdef __EMSCRIPTEN__
379+
double display_ratio = emscripten_get_device_pixel_ratio();
380+
window.width = static_cast<int>(window.width * display_ratio);
381+
window.height = static_cast<int>(window.height * display_ratio);
382+
#endif
378383
window.size_changed = true;
379384

380385
auto window_sg = lcf::makeScopeGuard([&]() {

0 commit comments

Comments
 (0)