17
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-10-17 21:29:19 +02:00
Files
maszyna/input/editorkeyboardinput.cpp
maj00r b8f040e6fd propagate template headers transitively, import Console where used
AnimModel.cpp reaches cParser through the simulation core, not a direct
import, so the previous pass missed it; the propagation now follows the
whole import closure. Train.cpp, drivermode.cpp and Globals.cpp call
Console:: inside _WIN32 guards without importing eu07.console - invisible
on Linux, where those blocks are skipped.
2026-09-10 01:41:24 +02:00

74 lines
2.0 KiB
C++

module;
#include <array>
#include <chrono>
#include <cstddef>
#include <limits>
#include <mutex>
#include <ostream>
#include <sstream>
#include <string>
#include <type_traits>
#include <utility>
#include <vector>
#include <deque>
#include <unordered_map>
#include <GLFW/glfw3.h>
module eu07.input.editorkeyboardinput;
import eu07.input.command;
import eu07.editor.editorsettings;
/*
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/.
*/
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::apply_scheme() {
default_bindings();
bind();
}
void
editorkeyboard_input::default_bindings() {
if (EditorSettings.movement() == editorSettings::movement_scheme::legacy) {
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"} },
};
}
else {
m_bindingsetups = {
{ user_command::moveleft, {GLFW_KEY_A, "Move left"} },
{ user_command::moveright, {GLFW_KEY_D, "Move right"} },
{ user_command::moveforward, {GLFW_KEY_W, "Move forwards"} },
{ user_command::moveback, {GLFW_KEY_S, "Move backwards"} },
{ user_command::moveup, {GLFW_KEY_E, "Move up"} },
{ user_command::movedown, {GLFW_KEY_Q, "Move down"} },
};
}
}
//---------------------------------------------------------------------------