本文整理汇总了C++中Entry::click方法的典型用法代码示例。如果您正苦于以下问题:C++ Entry::click方法的具体用法?C++ Entry::click怎么用?C++ Entry::click使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Entry
的用法示例。
在下文中一共展示了Entry::click方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: control
void Submenu::control(int key)
{
int b;
do
{
b = Input::instance->popButton();
}
while (Input::instance->popButton() != -1);
//get mouse position
const Mouse& mouse = Input::instance->mouse();
int videoHeight = Video::instance->getResolution().second;
Vector mousePos = Vector(static_cast<float>(mouse.x), 0.0f, static_cast<float>(videoHeight - mouse.y));
//adjust active entry depending on up/down keys
if ((key == GLFW_KEY_DOWN) || (key == GLFW_KEY_UP))
{
activateNextEntry(key == GLFW_KEY_DOWN);
m_menu->m_sound->play(m_menu->m_soundOver);
}
if (m_menu->m_mousePrevPos != mousePos)
{
//adjust active entry depending on mouse position
for (size_t i = 0; i < m_entries.size(); i++)
{
Entry* currentEntry = m_entries[i];
if ( (m_previousMousePos != mousePos)
&& currentEntry->isMouseOver(mousePos)
&& (currentEntry->isEnabled()))
{
if (m_activeEntry != i)
{
m_menu->m_sound->play(m_menu->m_soundOver);
}
m_activeEntry = i;
break;
}
}
m_menu->m_mousePrevPos = mousePos;
}
Entry* currentEntry = m_entries[m_activeEntry];
if (b != -1)
{
if (currentEntry->isMouseOver(mousePos))
{
currentEntry->click(b);
}
}
else if (key != -1)
{
currentEntry->click(key);
}
m_previousMousePos = mousePos;
}
示例2: control
void Submenu::control()
{
const Touches& touches = Input::instance->touches();
if (touches.empty() == false)
{
int x = touches.begin()->second.first;
int y = touches.begin()->second.second;
int videoHeight = Video::instance->getResolution().second;
Vector mousePos = Vector(static_cast<float>(x), 0.0f, static_cast<float>(videoHeight - y));
if (m_menu->m_mousePrevPos != mousePos)
{
//adjust active entry depending on mouse position
for (size_t i = 0; i < m_entries.size(); i++)
{
Entry* currentEntry = m_entries[i];
if ( (m_previousMousePos != mousePos)
&& currentEntry->isMouseOver(mousePos)
&& (currentEntry->isEnabled()))
{
if (m_activeEntry != i)
{
m_menu->m_sound->play(m_menu->m_soundOver);
}
m_activeEntry = i;
Input::instance->waitForRelease();
break;
}
}
m_menu->m_mousePrevPos = mousePos;
}
Entry* currentEntry = m_entries[m_activeEntry];
if (currentEntry->isMouseOver(mousePos))
{
currentEntry->click();
Input::instance->waitForRelease();
}
m_previousMousePos = mousePos;
}
}