mirror of
https://github.com/Zelda64Recomp/Zelda64Recomp.git
synced 2026-04-28 13:11:58 +00:00
Allow high dpi window
This commit is contained in:
parent
b086945b67
commit
dae2a5e857
4 changed files with 20 additions and 2 deletions
|
|
@ -12,6 +12,8 @@ namespace zelda64 {
|
||||||
// TODO: Move loading configs to the runtime once we have a way to allow per-project customization.
|
// TODO: Move loading configs to the runtime once we have a way to allow per-project customization.
|
||||||
void load_config();
|
void load_config();
|
||||||
void save_config();
|
void save_config();
|
||||||
|
|
||||||
|
bool is_steam_deck();
|
||||||
|
|
||||||
void reset_input_bindings();
|
void reset_input_bindings();
|
||||||
void reset_cont_input_bindings();
|
void reset_cont_input_bindings();
|
||||||
|
|
|
||||||
|
|
@ -1 +1 @@
|
||||||
Subproject commit 0c1811ca6f8291c6608f1d6626a73e863902ece9
|
Subproject commit c91627740f958b0902f96ea6c579e690b1fef7a1
|
||||||
|
|
@ -493,3 +493,7 @@ void zelda64::save_config() {
|
||||||
save_controls_config(recomp_dir / controls_filename);
|
save_controls_config(recomp_dir / controls_filename);
|
||||||
save_sound_config(recomp_dir / sound_filename);
|
save_sound_config(recomp_dir / sound_filename);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool zelda64::is_steam_deck() {
|
||||||
|
return ::is_steam_deck;
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -120,7 +120,19 @@ bool SetImageAsIcon(const char* filename, SDL_Window* window)
|
||||||
SDL_Window* window;
|
SDL_Window* window;
|
||||||
|
|
||||||
ultramodern::renderer::WindowHandle create_window(ultramodern::gfx_callbacks_t::gfx_data_t) {
|
ultramodern::renderer::WindowHandle create_window(ultramodern::gfx_callbacks_t::gfx_data_t) {
|
||||||
window = SDL_CreateWindow("Zelda 64: Recompiled", SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, 1600, 960, SDL_WINDOW_RESIZABLE );
|
uint32_t window_type = 0;
|
||||||
|
|
||||||
|
float dpi_scale = 1;
|
||||||
|
if (!zelda64::is_steam_deck()) {
|
||||||
|
float ddpi, hdpi, vdpi;
|
||||||
|
SDL_GetDisplayDPI(0, &ddpi, &hdpi, &vdpi);
|
||||||
|
window_type |= SDL_WINDOW_ALLOW_HIGHDPI;
|
||||||
|
dpi_scale = ddpi / 96;
|
||||||
|
}
|
||||||
|
|
||||||
|
auto res_width_dpi_scale = static_cast<uint32_t>(800 * dpi_scale);
|
||||||
|
auto res_height_dpi_scale = static_cast<uint32_t>(480 * dpi_scale);
|
||||||
|
window = SDL_CreateWindow("Zelda 64: Recompiled", SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, res_width_dpi_scale, res_height_dpi_scale, window_type | SDL_WINDOW_RESIZABLE );
|
||||||
#if defined(__linux__)
|
#if defined(__linux__)
|
||||||
SetImageAsIcon("icons/512.png",window);
|
SetImageAsIcon("icons/512.png",window);
|
||||||
if (ultramodern::renderer::get_graphics_config().wm_option == ultramodern::renderer::WindowMode::Fullscreen) { // TODO: Remove once RT64 gets native fullscreen support on Linux
|
if (ultramodern::renderer::get_graphics_config().wm_option == ultramodern::renderer::WindowMode::Fullscreen) { // TODO: Remove once RT64 gets native fullscreen support on Linux
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue