Toggle fullscreen mode when pressing Alt + Enter by default
Alt + Enter is a widely followed convention to toggle fullscreen. This adds support for it both in the editor and projects, as long as the window is configured to be resizable. The rationale for providing this feature in all projects is that many developers don't bother about adding a fullscreen toggle, especially for smaller/gamejam games. Yet, this convention is followed by many popular games out there, including AAA games. The shortcut can be modified or disabled by editing the Input Map in the Project Settings.
This commit is contained in:
@@ -433,6 +433,7 @@ static const _BuiltinActionDisplayName _builtin_action_display_names[] = {
|
||||
{ "ui_unicode_start", TTRC("Start Unicode Character Input") },
|
||||
{ "ui_colorpicker_delete_preset", TTRC("ColorPicker: Delete Preset") },
|
||||
{ "ui_accessibility_drag_and_drop", TTRC("Accessibility: Keyboard Drag and Drop") },
|
||||
{ "ui_toggle_fullscreen", TTRC("Toggle Fullscreen") },
|
||||
{ "", ""}
|
||||
/* clang-format on */
|
||||
};
|
||||
@@ -878,6 +879,16 @@ const HashMap<String, List<Ref<InputEvent>>> &InputMap::get_builtins() {
|
||||
inputs.push_back(InputEventKey::create_reference(Key::KEY_DELETE));
|
||||
default_builtin_cache.insert("ui_colorpicker_delete_preset", inputs);
|
||||
|
||||
// ///// Miscellaneous Shortcuts /////
|
||||
inputs = List<Ref<InputEvent>>();
|
||||
inputs.push_back(InputEventKey::create_reference(Key::ENTER | KeyModifierMask::ALT));
|
||||
default_builtin_cache.insert("ui_toggle_fullscreen", inputs);
|
||||
|
||||
inputs = List<Ref<InputEvent>>();
|
||||
inputs.push_back(InputEventKey::create_reference(Key::F | KeyModifierMask::CTRL | KeyModifierMask::META));
|
||||
inputs.push_back(InputEventKey::create_reference(Key::ENTER | KeyModifierMask::ALT));
|
||||
default_builtin_cache.insert("ui_toggle_fullscreen.macos", inputs);
|
||||
|
||||
return default_builtin_cache;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user