mirror of
https://github.com/rei-2/Amalgam.git
synced 2026-10-11 09:48:12 +08:00
key functionality changes
This commit is contained in:
1 parent
ba5fe7dcd3
commit
7a0c9e4d5c
5 files changed
+33
-17
No files matched your search
@@ -2085,22 +2085,35 @@ namespace ImGui
|
||||
{
|
||||
SetActiveID(uId, GetCurrentWindow());
|
||||
|
||||
int iKeyPressed = 0;
|
||||
for (short iKey = 0; iKey < 255; iKey++)
|
||||
for (short iKey = 1; iKey < 255; iKey++)
|
||||
{
|
||||
if (!vIgnore.empty() && std::find(vIgnore.begin(), vIgnore.end(), iKey) != vIgnore.end())
|
||||
bool bValid = U::KeyHandler.Pressed(iKey);
|
||||
if (!bValid)
|
||||
continue;
|
||||
|
||||
if (U::KeyHandler.Pressed(iKey))
|
||||
{
|
||||
iKeyPressed = iKey;
|
||||
break;
|
||||
}
|
||||
}
|
||||
bValid = vIgnore.empty() || std::find(vIgnore.begin(), vIgnore.end(), iKey) == vIgnore.end();
|
||||
if (!bValid)
|
||||
continue;
|
||||
|
||||
if (iKeyPressed && (iKeyPressed != VK_LBUTTON || !bHovered))
|
||||
{
|
||||
switch (iKeyPressed)
|
||||
switch (iKey)
|
||||
{
|
||||
case VK_LBUTTON:
|
||||
bValid = !bHovered; break;
|
||||
case VK_SHIFT:
|
||||
case VK_LSHIFT:
|
||||
case VK_RSHIFT:
|
||||
case VK_CONTROL:
|
||||
case VK_LCONTROL:
|
||||
case VK_RCONTROL:
|
||||
case VK_MENU:
|
||||
case VK_LMENU:
|
||||
case VK_RMENU:
|
||||
bValid = iKey != iOutput; break;
|
||||
}
|
||||
if (!bValid)
|
||||
continue;
|
||||
|
||||
switch (iKey)
|
||||
{
|
||||
case VK_ESCAPE:
|
||||
if (iFlags & FKeybindEnum::AllowNone)
|
||||
@@ -2110,9 +2123,10 @@ namespace ImGui
|
||||
}
|
||||
[[fallthrough]];
|
||||
default:
|
||||
iOutput = iKeyPressed;
|
||||
iOutput = iKey;
|
||||
}
|
||||
ClearActiveID();
|
||||
break;
|
||||
}
|
||||
|
||||
GetCurrentContext()->ActiveIdAllowOverlap = true;
|
||||
|
||||
@@ -4135,7 +4135,7 @@ void CMenu::Render()
|
||||
m_bInKeybind = false;
|
||||
if (m_bIsOpen)
|
||||
{
|
||||
for (short iKey = 0; iKey < 256; iKey++)
|
||||
for (short iKey = 1; iKey < 255; iKey++)
|
||||
U::KeyHandler.StoreKey(iKey);
|
||||
}
|
||||
else
|
||||
|
||||
@@ -70,7 +70,7 @@ void CDraw::UpdateKeyStrings()
|
||||
if (HKL pCurrLayout = GetKeyboardLayout(0); pCurrLayout != pLastLayout)
|
||||
{
|
||||
pLastLayout = pCurrLayout;
|
||||
for (short iKey = 0; iKey < 256; iKey++)
|
||||
for (short iKey = 1; iKey < 255; iKey++)
|
||||
U::KeyHandler.String(iKey, true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,7 +26,9 @@ void CKeyHandler::StoreKey(byte iKey, KeyStorage* pStorage)
|
||||
pStorage->m_bIsPressed = bPressed;
|
||||
pStorage->m_bIsDouble = bDouble;
|
||||
pStorage->m_bIsReleased = bReleased;
|
||||
if (bPressed)
|
||||
if (bDouble)
|
||||
pStorage->m_dPressTime = 0.0;
|
||||
else if (bPressed)
|
||||
pStorage->m_dPressTime = dFloatTime;
|
||||
}
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ public:
|
||||
public:
|
||||
std::string& String(byte iKey, const bool bStore = false);
|
||||
|
||||
std::array<std::string, 256> m_aStringStorage = {};
|
||||
std::array<std::string, 256> m_aStringStorage = { "none" };
|
||||
};
|
||||
|
||||
ADD_FEATURE_CUSTOM(CKeyHandler, KeyHandler, U);
|
||||
Reference in new issue
Block a user