Files
maszyna/editorkeyboardinput.cpp
jakubg1 84980a4484 Improve the keymapper
The keymapper, available as one of the options in the starting menu when the EXE is run without a scenery specified, has undergone a few changes:
- Key descriptions are now parsed the way Starter does and are displayed in the window. They are also no longer consumed when saving to a file.
- Unbound keys are now also displayed as well. Not all of them though; some entries won't exist if they are not specified in the eu07_input-keyboard.ini file.
- You can now unbind a key by pressing F10.

The Parser has got a new boolean option: `skipComments`, true by default to leave current behavior unchanged. When set to false, comments will be parsed as ordinary tokens.
2024-03-03 03:00:47 +01:00

38 lines
1022 B
C++

/*
This Source Code Form is subject to the
terms of the Mozilla Public License, v.
2.0. If a copy of the MPL was not
distributed with this file, You can
obtain one at
http://mozilla.org/MPL/2.0/.
*/
#include "stdafx.h"
#include "editorkeyboardinput.h"
bool
editorkeyboard_input::init() {
default_bindings();
// TODO: re-enable after mode-specific binding import is in place
// return recall_bindings();
bind();
return true;
}
void
editorkeyboard_input::default_bindings() {
m_bindingsetups = {
{ user_command::moveleft, {GLFW_KEY_LEFT, "Move left"} },
{ user_command::moveright, {GLFW_KEY_RIGHT, "Move right"} },
{ user_command::moveforward, {GLFW_KEY_UP, "Move forwards"} },
{ user_command::moveback, {GLFW_KEY_DOWN, "Move backwards"} },
{ user_command::moveup, {GLFW_KEY_PAGE_UP, "Move up"} },
{ user_command::movedown, {GLFW_KEY_PAGE_DOWN, "Move down"} },
};
}
//---------------------------------------------------------------------------