organized keybinds a lil bit (#1279)

This commit is contained in:
retucio
2026-03-16 00:11:55 +01:00
committed by GitHub
parent e9f5b4b6f0
commit 9fde19eca0
3 changed files with 17 additions and 9 deletions

View File

@@ -204,7 +204,7 @@ void Screen::updateEvents()
// Map to Screen::keyPressed
int mappedKey = -1;
wchar_t ch = 0;
if (vk == VK_ESCAPE) mappedKey = Keyboard::KEY_ESCAPE;
if (vk == VK_ESCAPE) mappedKey = Keyboard::KEY_ESCAPE;
else if (vk == VK_RETURN) mappedKey = Keyboard::KEY_RETURN;
else if (vk == VK_BACK) mappedKey = Keyboard::KEY_BACK;
else if (vk == VK_UP) mappedKey = Keyboard::KEY_UP;

View File

@@ -25,12 +25,20 @@ public:
static const int KEY_DROP = 'Q';
static const int KEY_CRAFTING = 'C';
static const int KEY_CRAFTING_ALT = 'R';
static const int KEY_CHAT = 'T';
static const int KEY_CONFIRM = VK_RETURN;
static const int KEY_CANCEL = VK_ESCAPE;
static const int KEY_PAUSE = VK_ESCAPE;
static const int KEY_THIRD_PERSON = VK_F5;
static const int KEY_TOGGLE_HUD = VK_F1;
static const int KEY_DEBUG_INFO = VK_F3;
static const int KEY_DEBUG_MENU = VK_F4;
static const int KEY_THIRD_PERSON = VK_F5;
static const int KEY_DEBUG_CONSOLE = VK_F6;
static const int KEY_HOST_SETTINGS = VK_F8;
static const int KEY_FULLSCREEN = VK_F11;
// todo: implement and shi
static const int KEY_SCREENSHOT = VK_F2;
void Init();
void Tick();

View File

@@ -1765,7 +1765,7 @@ int APIENTRY _tWinMain(_In_ HINSTANCE hInstance,
}
// F1 toggles the HUD
if (g_KBMInput.IsKeyPressed(VK_F1))
if (g_KBMInput.IsKeyPressed(KeyboardMouseInput::KEY_TOGGLE_HUD))
{
const int primaryPad = ProfileManager.GetPrimaryPad();
const unsigned char displayHud = app.GetGameSettings(primaryPad, eGameSetting_DisplayHUD);
@@ -1774,7 +1774,7 @@ int APIENTRY _tWinMain(_In_ HINSTANCE hInstance,
}
// F3 toggles onscreen debug info
if (g_KBMInput.IsKeyPressed(VK_F3))
if (g_KBMInput.IsKeyPressed(KeyboardMouseInput::KEY_DEBUG_INFO))
{
if (const Minecraft* pMinecraft = Minecraft::GetInstance())
{
@@ -1787,7 +1787,7 @@ int APIENTRY _tWinMain(_In_ HINSTANCE hInstance,
#ifdef _DEBUG_MENUS_ENABLED
// F6 Open debug console
if (g_KBMInput.IsKeyPressed(VK_F6))
if (g_KBMInput.IsKeyPressed(KeyboardMouseInput::KEY_DEBUG_CONSOLE))
{
static bool s_debugConsole = false;
s_debugConsole = !s_debugConsole;
@@ -1795,14 +1795,14 @@ int APIENTRY _tWinMain(_In_ HINSTANCE hInstance,
}
#endif
// F11 Toggle fullscreen
if (g_KBMInput.IsKeyPressed(VK_F11))
// toggle fullscreen
if (g_KBMInput.IsKeyPressed(KeyboardMouseInput::KEY_FULLSCREEN))
{
ToggleFullscreen();
}
// TAB opens game info menu. - Vvis :3 - Updated by detectiveren
if (g_KBMInput.IsKeyPressed(VK_TAB) && !ui.GetMenuDisplayed(0))
if (g_KBMInput.IsKeyPressed(KeyboardMouseInput::KEY_HOST_SETTINGS) && !ui.GetMenuDisplayed(0))
{
if (Minecraft* pMinecraft = Minecraft::GetInstance())
{
@@ -1814,7 +1814,7 @@ int APIENTRY _tWinMain(_In_ HINSTANCE hInstance,
}
// Open chat
if (g_KBMInput.IsKeyPressed('T') && app.GetGameStarted() && !ui.GetMenuDisplayed(0) && pMinecraft->screen == NULL)
if (g_KBMInput.IsKeyPressed(KeyboardMouseInput::KEY_CHAT) && app.GetGameStarted() && !ui.GetMenuDisplayed(0) && pMinecraft->screen == NULL)
{
g_KBMInput.ClearCharBuffer();
pMinecraft->setScreen(new ChatScreen());