Emscripten version doesnt take display scaling into account anymore
This commit is contained in:
parent
7baf629e04
commit
c5ba20173b
3 changed files with 13 additions and 1 deletions
|
|
@ -266,7 +266,11 @@ void MainProgram::set_vsync_value(int vsyncValue) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainProgram::update_scale_and_density() {
|
void MainProgram::update_scale_and_density() {
|
||||||
|
#ifdef __EMSCRIPTEN__
|
||||||
|
window.scale = 1.0f;
|
||||||
|
#else
|
||||||
window.scale = window.applyDisplayScale ? SDL_GetWindowDisplayScale(window.sdlWindow) : 1.0f;
|
window.scale = window.applyDisplayScale ? SDL_GetWindowDisplayScale(window.sdlWindow) : 1.0f;
|
||||||
|
#endif
|
||||||
window.density = SDL_GetWindowPixelDensity(window.sdlWindow);
|
window.density = SDL_GetWindowPixelDensity(window.sdlWindow);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -45,7 +45,9 @@ class MainProgram {
|
||||||
|
|
||||||
float density = 1.0f;
|
float density = 1.0f;
|
||||||
float scale = 1.0f;
|
float scale = 1.0f;
|
||||||
|
#ifndef __EMSCRIPTEN__
|
||||||
bool applyDisplayScale = true;
|
bool applyDisplayScale = true;
|
||||||
|
#endif
|
||||||
|
|
||||||
int defaultMSAASampleCount = 0;
|
int defaultMSAASampleCount = 0;
|
||||||
SkSurfaceProps defaultMSAASurfaceProps;
|
SkSurfaceProps defaultMSAASurfaceProps;
|
||||||
|
|
|
||||||
|
|
@ -254,7 +254,9 @@ nlohmann::json Toolbar::get_config_json() {
|
||||||
toRet["dragZoomSpeed"] = dragZoomSpeed;
|
toRet["dragZoomSpeed"] = dragZoomSpeed;
|
||||||
toRet["scrollZoomSpeed"] = scrollZoomSpeed;
|
toRet["scrollZoomSpeed"] = scrollZoomSpeed;
|
||||||
toRet["vsync"] = main.window.vsyncValue;
|
toRet["vsync"] = main.window.vsyncValue;
|
||||||
|
#ifndef __EMSCRIPTEN__
|
||||||
toRet["applyDisplayScale"] = main.window.applyDisplayScale;
|
toRet["applyDisplayScale"] = main.window.applyDisplayScale;
|
||||||
|
#endif
|
||||||
toRet["showPerformance"] = showPerformance;
|
toRet["showPerformance"] = showPerformance;
|
||||||
toRet["displayName"] = main.displayName;
|
toRet["displayName"] = main.displayName;
|
||||||
toRet["useNativeFilePicker"] = useNativeFilePicker;
|
toRet["useNativeFilePicker"] = useNativeFilePicker;
|
||||||
|
|
@ -314,7 +316,9 @@ void Toolbar::set_config_json(const nlohmann::json& j, VersionNumber version) {
|
||||||
catch(...) {
|
catch(...) {
|
||||||
main.set_vsync_value(1);
|
main.set_vsync_value(1);
|
||||||
}
|
}
|
||||||
|
#ifndef __EMSCRIPTEN__
|
||||||
try{j.at("applyDisplayScale").get_to(main.window.applyDisplayScale);} catch(...) {}
|
try{j.at("applyDisplayScale").get_to(main.window.applyDisplayScale);} catch(...) {}
|
||||||
|
#endif
|
||||||
try{j.at("guiScale").get_to(guiScale);} catch(...) {}
|
try{j.at("guiScale").get_to(guiScale);} catch(...) {}
|
||||||
try{j.at("showPerformance").get_to(showPerformance);} catch(...) {}
|
try{j.at("showPerformance").get_to(showPerformance);} catch(...) {}
|
||||||
try{j.at("useNativeFilePicker").get_to(useNativeFilePicker);} catch(...) {}
|
try{j.at("useNativeFilePicker").get_to(useNativeFilePicker);} catch(...) {}
|
||||||
|
|
@ -1462,7 +1466,9 @@ void Toolbar::options_menu() {
|
||||||
if(gui.radio_button_field("Vsync Adaptive", "Adaptive", main.window.vsyncValue == -1))
|
if(gui.radio_button_field("Vsync Adaptive", "Adaptive", main.window.vsyncValue == -1))
|
||||||
main.set_vsync_value(-1);
|
main.set_vsync_value(-1);
|
||||||
|
|
||||||
|
#ifndef __EMSCRIPTEN__
|
||||||
gui.checkbox_field("apply display scale", "Apply display scale", &main.window.applyDisplayScale);
|
gui.checkbox_field("apply display scale", "Apply display scale", &main.window.applyDisplayScale);
|
||||||
|
#endif
|
||||||
|
|
||||||
gui.pop_id();
|
gui.pop_id();
|
||||||
break;
|
break;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue