Big leap for key rebinding and crossplatform-ness.

This commit is contained in:
iProgramInCpp
2023-08-22 17:25:24 +03:00
parent f3fc78e151
commit d3ef629471
10 changed files with 248 additions and 279 deletions

View File

@@ -70,7 +70,7 @@ bool Screen::isInGameScreen()
void Screen::keyPressed(int key)
{
if (key == AKEYCODE_MENU)//escape
if (m_pMinecraft->m_options.isKey(KM_MENU_CANCEL, key))
{
m_pMinecraft->setScreen(nullptr);
}
@@ -78,19 +78,19 @@ void Screen::keyPressed(int key)
if (m_buttonTabList.size())
{
#ifndef ENH_HIGHLIGHT_BY_HOVER
if (m_pMinecraft->m_options.m_keyBinds[Options::MENU_NEXT].value == key)
if (m_pMinecraft->m_options.isKey(MENU_NEXT, key))
{
m_tabButtonIndex++;
if (m_tabButtonIndex == int(m_buttonTabList.size()))
m_tabButtonIndex = 0;
}
if (m_pMinecraft->m_options.m_keyBinds[Options::MENU_PREVIOUS].value == key)
if (m_pMinecraft->m_options.isKey(MENU_PREVIOUS, key))
{
m_tabButtonIndex--;
if (m_tabButtonIndex == -1)
m_tabButtonIndex = int(m_buttonTabList.size() - 1);
}
if (m_pMinecraft->m_options.m_keyBinds[Options::MENU_OK].value == key)
if (m_pMinecraft->m_options.isKey(MENU_OK, key))
{
if (m_buttonTabList[m_tabButtonIndex]->m_bEnabled)
{