mirror of https://github.com/xemu-project/xemu.git
ui: Remember UI scaling preference
This commit is contained in:
parent
be0c5f13cc
commit
8e50d32213
|
@ -204,6 +204,11 @@ void xemu_hud_init(SDL_Window* window, void* sdl_gl_context)
|
|||
if (show_first_boot_window) {
|
||||
show_main_menu = false;
|
||||
}
|
||||
|
||||
int ui_scale_int = 1;
|
||||
xemu_settings_get_int(XEMU_SETTINGS_DISPLAY_UI_SCALE, &ui_scale_int);
|
||||
if (ui_scale_int < 1) ui_scale_int = 1;
|
||||
ui_scale = ui_scale_int;
|
||||
}
|
||||
|
||||
void xemu_hud_process_sdl_events(SDL_Event *event)
|
||||
|
@ -269,6 +274,8 @@ static void ShowMainMenu()
|
|||
if (ui_scale_combo > 1) ui_scale_combo = 1;
|
||||
if (ImGui::Combo("UI Scale", &ui_scale_combo, "1x\0" "2x\0")) {
|
||||
ui_scale = ui_scale_combo + 1;
|
||||
xemu_settings_set_int(XEMU_SETTINGS_DISPLAY_UI_SCALE, ui_scale);
|
||||
xemu_settings_save();
|
||||
trigger_style_update = true;
|
||||
}
|
||||
|
||||
|
|
|
@ -46,6 +46,7 @@ struct xemu_settings {
|
|||
|
||||
// [display]
|
||||
int scale;
|
||||
int ui_scale;
|
||||
|
||||
// [input]
|
||||
char *controller_1_guid;
|
||||
|
@ -87,7 +88,8 @@ struct config_offset_table {
|
|||
[XEMU_SETTINGS_SYSTEM_MEMORY] = { CONFIG_TYPE_INT, "system", "memory", offsetof(struct xemu_settings, memory), { .default_int = 64 } },
|
||||
[XEMU_SETTINGS_SYSTEM_SHORTANIM] = { CONFIG_TYPE_BOOL, "system", "shortanim", offsetof(struct xemu_settings, short_animation), { .default_bool = 0 } },
|
||||
|
||||
[XEMU_SETTINGS_DISPLAY_SCALE] = { CONFIG_TYPE_ENUM, "display", "scale", offsetof(struct xemu_settings, scale), { .default_int = DISPLAY_SCALE_SCALE }, display_scale_map },
|
||||
[XEMU_SETTINGS_DISPLAY_SCALE] = { CONFIG_TYPE_ENUM, "display", "scale", offsetof(struct xemu_settings, scale), { .default_int = DISPLAY_SCALE_SCALE }, display_scale_map },
|
||||
[XEMU_SETTINGS_DISPLAY_UI_SCALE] = { CONFIG_TYPE_INT, "display", "ui_scale", offsetof(struct xemu_settings, ui_scale), { .default_int = 1 } },
|
||||
|
||||
[XEMU_SETTINGS_INPUT_CONTROLLER_1_GUID] = { CONFIG_TYPE_STRING, "input", "controller_1_guid", offsetof(struct xemu_settings, controller_1_guid), { .default_str = "" } },
|
||||
[XEMU_SETTINGS_INPUT_CONTROLLER_2_GUID] = { CONFIG_TYPE_STRING, "input", "controller_2_guid", offsetof(struct xemu_settings, controller_2_guid), { .default_str = "" } },
|
||||
|
|
|
@ -37,6 +37,7 @@ enum xemu_settings_keys {
|
|||
XEMU_SETTINGS_SYSTEM_MEMORY,
|
||||
XEMU_SETTINGS_SYSTEM_SHORTANIM,
|
||||
XEMU_SETTINGS_DISPLAY_SCALE,
|
||||
XEMU_SETTINGS_DISPLAY_UI_SCALE,
|
||||
XEMU_SETTINGS_INPUT_CONTROLLER_1_GUID,
|
||||
XEMU_SETTINGS_INPUT_CONTROLLER_2_GUID,
|
||||
XEMU_SETTINGS_INPUT_CONTROLLER_3_GUID,
|
||||
|
|
Loading…
Reference in New Issue