本文整理汇总了C++中CBinds类的典型用法代码示例。如果您正苦于以下问题:C++ CBinds类的具体用法?C++ CBinds怎么用?C++ CBinds使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CBinds类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ConfigSaveCallback
void CBinds::ConfigSaveCallback(IConfig *pConfig, void *pUserData)
{
CBinds *pSelf = (CBinds *)pUserData;
char aBuffer[256];
char *pEnd = aBuffer+sizeof(aBuffer)-8;
pConfig->WriteLine("unbindall");
for(int i = 0; i < KEY_LAST; i++)
{
if(pSelf->m_aaKeyBindings[i][0] == 0)
continue;
str_format(aBuffer, sizeof(aBuffer), "bind %s ", pSelf->Input()->KeyName(i));
// process the string. we need to escape some characters
const char *pSrc = pSelf->m_aaKeyBindings[i];
char *pDst = aBuffer + str_length(aBuffer);
*pDst++ = '"';
while(*pSrc && pDst < pEnd)
{
if(*pSrc == '"' || *pSrc == '\\') // escape \ and "
*pDst++ = '\\';
*pDst++ = *pSrc++;
}
*pDst++ = '"';
*pDst++ = 0;
pConfig->WriteLine(aBuffer);
}
}
示例2: ConDumpBinds
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);
}
}
示例3: ConDumpBinds
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);
}
}
示例4: ConUnbind
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)
{
dbg_msg("binds", "key %s not found", pKeyName);
return;
}
pBinds->Bind(id, "");
}
示例5: ConUnbind
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, "");
}
示例6: ConUnbind
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, "");
}
示例7: ConUnbindAll
void CBinds::ConUnbindAll(IConsole::IResult *pResult, void *pUserData)
{
CBinds *pBinds = (CBinds *)pUserData;
pBinds->UnbindAll();
}
示例8: OnInit
void CGameClient::OnInit()
{
m_pGraphics = Kernel()->RequestInterface<IGraphics>();
// propagate pointers
m_UI.SetGraphics(Graphics(), TextRender());
m_RenderTools.m_pGraphics = Graphics();
m_RenderTools.m_pUI = UI();
int64 Start = time_get();
// set the language
g_Localization.Load(g_Config.m_ClLanguagefile, Storage(), Console());
// TODO: this should be different
// setup item sizes
for(int i = 0; i < NUM_NETOBJTYPES; i++)
Client()->SnapSetStaticsize(i, m_NetObjHandler.GetObjSize(i));
// load default font
static CFont *pDefaultFont = 0;
char aFilename[512];
IOHANDLE File = Storage()->OpenFile("fonts/DejaVuSans.ttf", IOFLAG_READ, IStorage::TYPE_ALL, aFilename, sizeof(aFilename));
if(File)
{
io_close(File);
pDefaultFont = TextRender()->LoadFont(aFilename);
TextRender()->SetDefaultFont(pDefaultFont);
}
if(!pDefaultFont)
Console()->Print(IConsole::OUTPUT_LEVEL_STANDARD, "gameclient", "failed to load font. filename='fonts/DejaVuSans.ttf'");
// init all components
for(int i = m_All.m_Num-1; i >= 0; --i)
m_All.m_paComponents[i]->OnInit();
// setup load amount// load textures
for(int i = 0; i < g_pData->m_NumImages; i++)
{
g_pData->m_aImages[i].m_Id = Graphics()->LoadTexture(g_pData->m_aImages[i].m_pFilename, IStorage::TYPE_ALL, CImageInfo::FORMAT_AUTO, 0);
g_GameClient.m_pMenus->RenderLoading();
}
for(int i = 0; i < m_All.m_Num; i++)
m_All.m_paComponents[i]->OnReset();
int64 End = time_get();
char aBuf[256];
str_format(aBuf, sizeof(aBuf), "initialisation finished after %.2fms", ((End-Start)*1000)/(float)time_freq());
Console()->Print(IConsole::OUTPUT_LEVEL_DEBUG, "gameclient", aBuf);
m_ServerMode = SERVERMODE_PURE;
m_DDRaceMsgSent = false;
m_ShowOthers = -1;
// Set free binds to DDRace binds if it's active
if(!g_Config.m_ClDDRaceBindsSet && g_Config.m_ClDDRaceBinds)
gs_Binds.SetDDRaceBinds(true);
}