mirror of
https://github.com/luanti-org/luanti.git
synced 2025-10-05 19:31:04 +00:00
Add keybinding for world close key (#16250)
Fix according to Lua code style guidelines (grorp) Fix order in defaultsettings.cpp (grorp) remove unrequired comment, and whitespace Co-authored-by: y5nw <y5nw@users.noreply.github.com> Co-authored-by: grorp <grorp@users.noreply.github.com>
This commit is contained in:
parent
43aad3711b
commit
80be9bf76e
5 changed files with 41 additions and 8 deletions
|
@ -137,6 +137,7 @@ bool MyEventReceiver::OnEvent(const SEvent &event)
|
|||
// This is separate from other keyboard handling so that it also works in menus.
|
||||
if (event.EventType == EET_KEY_INPUT_EVENT) {
|
||||
KeyPress keyCode(event.KeyInput);
|
||||
|
||||
if (keyCode == getKeySetting("keymap_fullscreen")) {
|
||||
if (event.KeyInput.PressedDown && !fullscreen_is_down) {
|
||||
IrrlichtDevice *device = RenderingEngine::get_raw_device();
|
||||
|
@ -150,8 +151,15 @@ bool MyEventReceiver::OnEvent(const SEvent &event)
|
|||
}
|
||||
fullscreen_is_down = event.KeyInput.PressedDown;
|
||||
return true;
|
||||
} else if (keyCode == EscapeKey &&
|
||||
event.KeyInput.PressedDown && event.KeyInput.Shift) {
|
||||
|
||||
} else if (keyCode == getKeySetting("keymap_close_world")) {
|
||||
close_world_down = event.KeyInput.PressedDown;
|
||||
|
||||
} else if (keyCode == EscapeKey) {
|
||||
esc_down = event.KeyInput.PressedDown;
|
||||
}
|
||||
|
||||
if (esc_down && close_world_down) {
|
||||
g_gamecallback->disconnect();
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -128,6 +128,9 @@ private:
|
|||
// Intentionally not reset by clearInput/releaseAllKeys.
|
||||
bool fullscreen_is_down = false;
|
||||
|
||||
bool close_world_down = false;
|
||||
bool esc_down = false;
|
||||
|
||||
PointerType last_pointer_type = PointerType::Mouse;
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue