Example #1
0
void CBinds::ConDumpBinds(IConsole::IResult *pResult, void *pUserData)
{
	CBinds *pBinds = (CBinds *)pUserData;
	char aBuf[1024];
	for(int i = 0; i < KEY_LAST; i++)
	{
		if(pBinds->m_aaKeyBindings[i][0] == 0)
			continue;
		str_format(aBuf, sizeof(aBuf), "[binds] %s (%d) = %s", pBinds->Input()->KeyName(i), i, pBinds->m_aaKeyBindings[i]);
		pBinds->Console()->Print(aBuf);
	}
}
Example #2
0
void CBinds::ConDumpBinds(IConsole::IResult *pResult, void *pUserData)
{
    CBinds *pBinds = (CBinds *)pUserData;
    char aBuf[1024];
    for(int i = 0; i < KEY_LAST; i++)
    {
        if(pBinds->m_aKeyBindings[i].empty())
            continue;
        str_format(aBuf, sizeof(aBuf), "%s (%d) = %s", IInput::KeyName(i), i, pBinds->m_aKeyBindings[i].line.c_str());
        pBinds->Console()->Print(IConsole::OUTPUT_LEVEL_STANDARD, "binds", aBuf);
    }
}
Example #3
0
void CBinds::ConUnbind(IConsole::IResult *pResult, void *pUserData)
{
	CBinds *pBinds = (CBinds *)pUserData;
	const char *pKeyName = pResult->GetString(0);
	int id = pBinds->GetKeyID(pKeyName);

	if(!id)
	{
		char aBuf[256];
		str_format(aBuf, sizeof(aBuf), "key %s not found", pKeyName);
		pBinds->Console()->Print(IConsole::OUTPUT_LEVEL_STANDARD, "binds", aBuf);
		return;
	}

	pBinds->Bind(id, "");
}
Example #4
0
void CBinds::ConUnbind(IConsole::IResult *pResult, void *pUserData)
{
    CBinds *pBinds = (CBinds *)pUserData;
    const char *pKeyName = pResult->GetString(0);
    std::pair<unsigned, unsigned> KeyComb = KeyCombByName(pKeyName);
    unsigned id = KeyComb.first, keymods = KeyComb.second;

    if(!id)
    {
        char aBuf[256];
        str_format(aBuf, sizeof(aBuf), "key %s not found", pKeyName);
        pBinds->Console()->Print(IConsole::OUTPUT_LEVEL_STANDARD, "binds", aBuf);
        return;
    }

    if(!keymods && pKeyName[0] != '+')
        pBinds->Bind(id, "");
    else
        pBinds->Bind(id, keymods, "");
}