本文整理汇总了C++中CubeSet::begin方法的典型用法代码示例。如果您正苦于以下问题:C++ CubeSet::begin方法的具体用法?C++ CubeSet::begin怎么用?C++ CubeSet::begin使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CubeSet
的用法示例。
在下文中一共展示了CubeSet::begin方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: eventLoop
void MainMenu::eventLoop()
{
while (1) {
// Need to bind the menu to a new cube?
if (!mainCube.isDefined()) {
/*
* Make sure we have at least one cube. Until we do, there's nothing
* we can do, so just play our "cube missing" sound periodically.
*
* This exits as soon as at least one cube is in CubeSet::connected(),
* but that cube may still be busy loading assets or showing the logo.
*/
waitForACube();
/*
* Wait until we have a cube that's usable for our menu
*/
while (1) {
CubeSet usable = CubeSet::connected() & ~connectingCubes;
if (usable.empty()) {
System::paint();
updateMusic();
updateConnecting();
System::yield();
continue;
} else {
mainCube = *usable.begin();
break;
}
}
// try and avoid some of the garbage we often see :P
System::finish();
if (itemIndexCurrent >= 0) {
if (itemIndexCurrent > 0 && items[itemIndexCurrent]->isFirstRun()) {
initMenu(itemIndexCurrent, true, 0);
} else {
initMenu(itemIndexCurrent, true);
}
} else {
initMenu(0, false);
}
}
MenuEvent e;
itemIndexChoice = -1;
// Keep running until a choice is made or the menu cube disconnects
while (mainCube.isDefined() && menu.pollEvent(&e)) {
updateConnecting();
updateSound();
updateMusic();
updateAlerts();
handleEvent(e);
}
if (itemIndexChoice >= 0) {
ASSERT(itemIndexChoice < items.count());
return execItem(items[itemIndexChoice]);
}
}
}