BIND_DEVTOOLS_CONSOLE

This commit is contained in:
MihailRis 2024-05-17 03:40:24 +03:00
parent bb4f573d0f
commit 5834233162
6 changed files with 8 additions and 0 deletions

View File

@ -9,6 +9,7 @@ world.generators.default=Default
world.generators.flat=Flat
# Bindings
devtools.console=Console
movement.forward=Forward
movement.back=Back
movement.left=Left

View File

@ -56,6 +56,7 @@ settings.UI Sounds=Звуки Интерфейса
settings.V-Sync=Вертикальная Синхронизация
# Управление
devtools.console=Консоль
movement.forward=Вперёд
movement.back=Назад
movement.left=Влево

View File

@ -24,6 +24,7 @@ void corecontent::setup(ContentBuilder* builder) {
}
void corecontent::setup_bindings() {
Events::bind(BIND_DEVTOOLS_CONSOLE, inputtype::keyboard, keycode::GRAVE_ACCENT);
Events::bind(BIND_MOVE_FORWARD, inputtype::keyboard, keycode::W);
Events::bind(BIND_MOVE_BACK, inputtype::keyboard, keycode::S);
Events::bind(BIND_MOVE_RIGHT, inputtype::keyboard, keycode::D);

View File

@ -9,6 +9,7 @@ inline const std::string CORE_AIR = "core:air";
inline const std::string TEXTURE_NOTFOUND = "notfound";
// built-in bindings
inline const std::string BIND_DEVTOOLS_CONSOLE = "devtools.console";
inline const std::string BIND_MOVE_FORWARD = "movement.forward";
inline const std::string BIND_MOVE_BACK = "movement.back";
inline const std::string BIND_MOVE_LEFT = "movement.left";

View File

@ -204,6 +204,9 @@ void Hud::processInput(bool visible) {
setPause(true);
}
}
if (!pause && Events::active(BIND_DEVTOOLS_CONSOLE)) {
showOverlay(assets->getLayout("core:console"), false);
}
if (!Window::isFocused() && !pause && !isInventoryOpen()) {
setPause(true);
}

View File

@ -7,6 +7,7 @@
/// @brief Represents glfw3 keycode values.
enum class keycode : int {
GRAVE_ACCENT = 96,
ENTER = 257,
TAB = 258,
SPACE = 32,