本文整理汇总了C++中COption::SetValue方法的典型用法代码示例。如果您正苦于以下问题:C++ COption::SetValue方法的具体用法?C++ COption::SetValue怎么用?C++ COption::SetValue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类COption
的用法示例。
在下文中一共展示了COption::SetValue方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Update
void COption::Update(float deltaTime)
{
// GUI EDITOR
if(CVgui_editor.GetBool() && !(GetElementFlags() & EF_NOT_EDITABLE))
{
if (!m_szName) return; // neoznacene prvky nelze upravovat
// popisek
char str[64];
bool popisek=false;
if (g_bLMouseDownFirstTime)
{
if ((g_nMouseX>m_nPosX+m_nParentX+m_nWidth-3 && g_nMouseX <= m_nPosX+m_nParentX+m_nWidth)
&& (g_nMouseY>m_nPosY+m_nParentY+m_nHeight-3 && g_nMouseY <= m_nPosY+m_nParentY+m_nHeight))
{
edit_mode = 2; // resize
}
else if (g_nMouseX >= m_nPosX+m_nParentX && g_nMouseX <= m_nPosX+m_nParentX+m_nWidth
&& g_nMouseY >= m_nPosY+m_nParentY && g_nMouseY <= m_nPosY+m_nParentY+m_nHeight)
{
edit_mode = 1; // move
edit_nRelPosX = g_nMouseX - m_nPosX;
edit_nRelPosY = g_nMouseY - m_nPosY;
}
}
else if (g_bLMouseUpFirstTime)
{
edit_mode = 0; // konec
}
// pokud je co delat, tak to udelej
if (edit_mode==1) // move
{
m_nPosX = g_nMouseX - edit_nRelPosX;
m_nPosY = g_nMouseY - edit_nRelPosY;
sprintf(str, "X%d Y%d", m_nPosX, m_nPosY);
g_Scheme._pLabelFont->DrawText(str, g_nMouseX+10, g_nMouseY+10, P3DCOLOR_XRGB(255, 255, 255));
popisek = true;
}
else if (edit_mode==2) // resize
{
m_nWidth = g_nMouseX - m_nPosX - m_nParentX;
m_nHeight = g_nMouseY - m_nPosY - m_nParentY;
sprintf(str, "W%d H%d", m_nWidth, m_nHeight);
g_Scheme._pLabelFont->DrawText(str, g_nMouseX+10, g_nMouseY+10, P3DCOLOR_XRGB(255, 255, 255));
popisek = true;
}
// pokud neni zaden popisek a mys je nad timto prvkem, udelej popisek
if (g_nMouseX >= m_nPosX+m_nParentX && g_nMouseX <= m_nPosX+m_nParentX+m_nWidth
&& g_nMouseY >= m_nPosY+m_nParentY && g_nMouseY <= m_nPosY+m_nParentY+m_nHeight)
{
// popisek
char str[64];
if (!popisek)
{
// vykresli okraje
g_p2D->Line_DrawRect(m_nPosX+m_nParentX, m_nPosY+m_nParentY, m_nWidth, m_nHeight, P3DCOLOR_ARGB(100, 0, 255, 0));
sprintf(str, "%s", m_szName);
g_Scheme._pLabelFont->DrawText(str, g_nMouseX+10, g_nMouseY+10, P3DCOLOR_ARGB(100, 255, 255, 255));
}
}
return; // editor mode
}
//-GUI EDITOR
m_bDrawGrayed=false;
m_bOnSelect = false;
m_bOnUnselect = false;
if(g_nMouseX >= m_nPosX+m_nParentX && g_nMouseX <= m_nPosX+m_nParentX+m_nWidth
&& g_nMouseY >= m_nPosY+m_nParentY && g_nMouseY <= m_nPosY+m_nParentY+m_nHeight)
{
if (g_bLMouseDownFirstTime) m_bDownFirstTime=true;
if(g_bLMouseDown && m_bDownFirstTime) m_bDrawGrayed=true; // vykresli zesedle
if(g_bLMouseUpFirstTime)
{
if (m_bDownFirstTime) {
// vsechny nastav jako false
for(unsigned int i=0;i<m_pParent->m_nChilds;i++)
{
if(m_pParent->m_pChilds[i]->m_nElementID == 1) // je to Option
{
// pokud to neni tento Option a neni skryt
if(!m_pParent->m_pChilds[i]->m_bHidden)
{
COption* pOpt = (COption*)m_pParent->m_pChilds[i];
pOpt->SetValue(false); // nastav jako false
}
}
}
m_bValue = true; // vyber tento jako aktivni
}
m_bDownFirstTime = false;
}
}
// zjisti zda byl aktivovan nebo deaktivovan
//.........这里部分代码省略.........