Add shortcuts for changing the scaling value. (#10341)

Fixes #10305
This commit is contained in:
Abd Narane 2019-12-13 18:31:23 +02:00 committed by Michał Janiszewski
parent 440f012e8a
commit 1ace96ccc4
7 changed files with 32 additions and 1 deletions

View File

@ -3652,6 +3652,8 @@ STR_6329 :{STRING}{STRINGID}
STR_6330 :Downloading [{STRING}] from {STRING} ({COMMA16} / {COMMA16})
STR_6331 :Create Ducks
STR_6332 :Remove Ducks
STR_6333 :Increase scale factor
STR_6334 :Decrease scale factor
#############
# Scenarios #

View File

@ -1,5 +1,6 @@
0.2.4+ (in development)
------------------------------------------------------------------------
- Feature: [#10305] Add two shortcuts for increasing and decreasing the scaling factor.
- Change: [#1164] Use available translations for shortcut key bindings.
- Fix: [#10228] Can't import RCT1 Deluxe from Steam.
- Fix: [#10325] Crash when banners have no text.

View File

@ -795,6 +795,25 @@ static void shortcut_open_scenery_picker()
}
}
static void shortcut_scale_up()
{
gConfigGeneral.window_scale += 0.25f;
config_save_default();
gfx_invalidate_screen();
context_trigger_resize();
context_update_cursor_scale();
}
static void shortcut_scale_down()
{
gConfigGeneral.window_scale -= 0.25f;
gConfigGeneral.window_scale = std::max(0.5f, gConfigGeneral.window_scale);
config_save_default();
gfx_invalidate_screen();
context_trigger_resize();
context_update_cursor_scale();
}
namespace
{
const shortcut_action shortcut_table[SHORTCUT_COUNT] = {
@ -870,6 +889,8 @@ namespace
shortcut_open_tile_inspector,
shortcut_advance_to_next_tick,
shortcut_open_scenery_picker,
shortcut_scale_up,
shortcut_scale_down,
};
} // anonymous namespace

View File

@ -369,4 +369,6 @@ const uint16_t KeyboardShortcuts::DefaultKeys[SHORTCUT_COUNT] = {
SHORTCUT_UNDEFINED, // SHORTCUT_TILE_INSPECTOR
SHORTCUT_UNDEFINED, // SHORTCUT_ADVANCE_TO_NEXT_TICK
SHORTCUT_UNDEFINED, // SHORTCUT_SCENERY_PICKER
SHORTCUT_UNDEFINED, // SHORTCUT_SCALE_UP
SHORTCUT_UNDEFINED, // SHORTCUT_SCALE_DOWN
};

View File

@ -97,6 +97,8 @@ enum
SHORTCUT_TILE_INSPECTOR,
SHORTCUT_ADVANCE_TO_NEXT_TICK,
SHORTCUT_SCENERY_PICKER,
SHORTCUT_SCALE_UP,
SHORTCUT_SCALE_DOWN,
SHORTCUT_COUNT,

View File

@ -151,6 +151,8 @@ const rct_string_id ShortcutStringIds[SHORTCUT_COUNT] = {
STR_SHORTCUT_OPEN_TILE_INSPECTOR,
STR_ADVANCE_TO_NEXT_TICK,
STR_SHORTCUT_OPEN_SCENERY_PICKER,
STR_SHORTCUT_SCALE_UP,
STR_SHORTCUT_SCALE_DOWN,
};
// clang-format on

View File

@ -3876,7 +3876,8 @@ enum
STR_CREATE_DUCKS = 6331,
STR_REMOVE_DUCKS = 6332,
STR_SHORTCUT_SCALE_UP = 6333,
STR_SHORTCUT_SCALE_DOWN = 6334,
// Have to include resource strings (from scenarios and objects) for the time being now that language is partially working
STR_COUNT = 32768
};