mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 10:08:18 +00:00
client/menus: Fix variable names
This commit is contained in:
parent
343b2543cc
commit
db1d136006
|
@ -595,7 +595,7 @@ int CMenus::DoValueSelector(void *pID, CUIRect *pRect, const char *pLabel, bool
|
|||
return Current;
|
||||
}
|
||||
|
||||
int CMenus::DoKeyReader(void *pID, const CUIRect *pRect, int Key, int Modifier, int *NewModifier)
|
||||
int CMenus::DoKeyReader(void *pID, const CUIRect *pRect, int Key, int ModifierCombination, int *NewModifierCombination)
|
||||
{
|
||||
// process
|
||||
static void *pGrabbedID = 0;
|
||||
|
@ -603,7 +603,7 @@ int CMenus::DoKeyReader(void *pID, const CUIRect *pRect, int Key, int Modifier,
|
|||
static int ButtonUsed = 0;
|
||||
int Inside = UI()->MouseInside(pRect);
|
||||
int NewKey = Key;
|
||||
*NewModifier = Modifier;
|
||||
*NewModifierCombination = ModifierCombination;
|
||||
|
||||
if(!UI()->MouseButton(0) && !UI()->MouseButton(1) && pGrabbedID == pID)
|
||||
MouseReleased = true;
|
||||
|
@ -616,7 +616,7 @@ int CMenus::DoKeyReader(void *pID, const CUIRect *pRect, int Key, int Modifier,
|
|||
if(m_Binder.m_Key.m_Key != KEY_ESCAPE)
|
||||
{
|
||||
NewKey = m_Binder.m_Key.m_Key;
|
||||
*NewModifier = m_Binder.m_Modifier;
|
||||
*NewModifierCombination = m_Binder.m_ModifierCombination;
|
||||
}
|
||||
m_Binder.m_GotKey = false;
|
||||
UI()->SetActiveItem(0);
|
||||
|
@ -662,8 +662,8 @@ int CMenus::DoKeyReader(void *pID, const CUIRect *pRect, int Key, int Modifier,
|
|||
if(Key)
|
||||
{
|
||||
char aBuf[64];
|
||||
if(*NewModifier)
|
||||
str_format(aBuf, sizeof(aBuf), "%s+%s", CBinds::GetModifierName(*NewModifier), Input()->KeyName(Key));
|
||||
if(*NewModifierCombination)
|
||||
str_format(aBuf, sizeof(aBuf), "%s+%s", CBinds::GetModifierName(*NewModifierCombination), Input()->KeyName(Key));
|
||||
else
|
||||
str_format(aBuf, sizeof(aBuf), "%s", Input()->KeyName(Key));
|
||||
|
||||
|
|
|
@ -50,7 +50,7 @@ public:
|
|||
bool m_TakeKey;
|
||||
bool m_GotKey;
|
||||
IInput::CEvent m_Key;
|
||||
int m_Modifier;
|
||||
int m_ModifierCombination;
|
||||
CMenusKeyBinder();
|
||||
virtual int Sizeof() const override { return sizeof(*this); }
|
||||
virtual bool OnInput(IInput::CEvent Event) override;
|
||||
|
@ -95,7 +95,7 @@ class CMenus : public CComponent
|
|||
int DoButton_GridHeader(const void *pID, const char *pText, int Checked, const CUIRect *pRect);
|
||||
|
||||
void DoButton_KeySelect(const void *pID, const char *pText, int Checked, const CUIRect *pRect);
|
||||
int DoKeyReader(void *pID, const CUIRect *pRect, int Key, int Modifier, int *NewModifier);
|
||||
int DoKeyReader(void *pID, const CUIRect *pRect, int Key, int ModifierCombination, int *NewModifierCombination);
|
||||
|
||||
void UiDoGetButtons(int Start, int Stop, CUIRect View, CUIRect ScopeView);
|
||||
|
||||
|
|
|
@ -38,7 +38,7 @@ CMenusKeyBinder::CMenusKeyBinder()
|
|||
{
|
||||
m_TakeKey = false;
|
||||
m_GotKey = false;
|
||||
m_Modifier = 0;
|
||||
m_ModifierCombination = 0;
|
||||
}
|
||||
|
||||
bool CMenusKeyBinder::OnInput(IInput::CEvent Event)
|
||||
|
@ -53,14 +53,14 @@ bool CMenusKeyBinder::OnInput(IInput::CEvent Event)
|
|||
m_TakeKey = false;
|
||||
|
||||
int Mask = CBinds::GetModifierMask(Input());
|
||||
m_Modifier = 0;
|
||||
m_ModifierCombination = 0;
|
||||
while(!(Mask & 1))
|
||||
{
|
||||
Mask >>= 1;
|
||||
m_Modifier++;
|
||||
m_ModifierCombination++;
|
||||
}
|
||||
if(CBinds::ModifierMatchesKey(m_Modifier, Event.m_Key))
|
||||
m_Modifier = 0;
|
||||
if(CBinds::ModifierMatchesKey(m_ModifierCombination, Event.m_Key))
|
||||
m_ModifierCombination = 0;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -790,7 +790,7 @@ typedef struct
|
|||
CLocConstString m_Name;
|
||||
const char *m_pCommand;
|
||||
int m_KeyId;
|
||||
int m_Modifier;
|
||||
int m_ModifierCombination;
|
||||
} CKeyInfo;
|
||||
|
||||
static CKeyInfo gs_aKeys[] =
|
||||
|
@ -874,14 +874,14 @@ void CMenus::UiDoGetButtons(int Start, int Stop, CUIRect View, CUIRect ScopeView
|
|||
str_format(aBuf, sizeof(aBuf), "%s:", Localize((const char *)Key.m_Name));
|
||||
|
||||
UI()->DoLabelScaled(&Label, aBuf, 13.0f, TEXTALIGN_LEFT);
|
||||
int OldId = Key.m_KeyId, OldModifier = Key.m_Modifier, NewModifier;
|
||||
int NewId = DoKeyReader((void *)&gs_aKeys[i].m_Name, &Button, OldId, OldModifier, &NewModifier);
|
||||
if(NewId != OldId || NewModifier != OldModifier)
|
||||
int OldId = Key.m_KeyId, OldModifierCombination = Key.m_ModifierCombination, NewModifierCombination;
|
||||
int NewId = DoKeyReader((void *)&Key.m_Name, &Button, OldId, OldModifierCombination, &NewModifierCombination);
|
||||
if(NewId != OldId || NewModifierCombination != OldModifierCombination)
|
||||
{
|
||||
if(OldId != 0 || NewId == 0)
|
||||
m_pClient->m_Binds.Bind(OldId, "", false, OldModifier);
|
||||
m_pClient->m_Binds.Bind(OldId, "", false, OldModifierCombination);
|
||||
if(NewId != 0)
|
||||
m_pClient->m_Binds.Bind(NewId, gs_aKeys[i].m_pCommand, false, NewModifier);
|
||||
m_pClient->m_Binds.Bind(NewId, gs_aKeys[i].m_pCommand, false, NewModifierCombination);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -895,7 +895,7 @@ void CMenus::RenderSettingsControls(CUIRect MainView)
|
|||
|
||||
// this is kinda slow, but whatever
|
||||
for(auto &Key : gs_aKeys)
|
||||
Key.m_KeyId = Key.m_Modifier = 0;
|
||||
Key.m_KeyId = Key.m_ModifierCombination = 0;
|
||||
|
||||
for(int Mod = 0; Mod < CBinds::MODIFIER_COUNT; Mod++)
|
||||
{
|
||||
|
@ -909,7 +909,7 @@ void CMenus::RenderSettingsControls(CUIRect MainView)
|
|||
if(str_comp(pBind, Key.m_pCommand) == 0)
|
||||
{
|
||||
Key.m_KeyId = KeyId;
|
||||
Key.m_Modifier = Mod;
|
||||
Key.m_ModifierCombination = Mod;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue