当前位置: 首页>>代码示例>>C++>>正文


C++ JoyDPad::getJoyButtons方法代码示例

本文整理汇总了C++中JoyDPad::getJoyButtons方法的典型用法代码示例。如果您正苦于以下问题:C++ JoyDPad::getJoyButtons方法的具体用法?C++ JoyDPad::getJoyButtons怎么用?C++ JoyDPad::getJoyButtons使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在JoyDPad的用法示例。


在下文中一共展示了JoyDPad::getJoyButtons方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: setActiveSetNumber


//.........这里部分代码省略.........
                    }
                    else if (!button->getWhileHeldStatus())
                    {
                        // Ensure that set change events are performed if needed.
                        tempignore = false;
                    }
                }
                else
                {
                    // Ensure that set change events are performed if needed.
                    button->setWhileHeldStatus(false);
                    //tempignore = false;
                }
            }

            button->joyEvent(value, tempignore);
        }

        // Activate all axis buttons in the switched set
        for (int i = 0; i < current_set->getNumberAxes(); i++)
        {
            int value = axesstates.at(i);
            bool tempignore = true;
            JoyAxis *axis = current_set->getJoyAxis(i);
            JoyAxisButton *oldButton = old_set->getJoyAxis(i)->getAxisButtonByValue(value);
            JoyAxisButton *button = axis->getAxisButtonByValue(value);

            if (button && oldButton)
            {
                if (button->getChangeSetCondition() == JoyButton::SetChangeWhileHeld)
                {
                    if (oldButton->getChangeSetCondition() == JoyButton::SetChangeWhileHeld && oldButton->getWhileHeldStatus())
                    {
                        // Button from old set involved in a while held set
                        // change. Carry over to new set button to ensure
                        // set changes are done in the proper order.
                        button->setWhileHeldStatus(true);
                    }
                    else if (!button->getWhileHeldStatus())
                    {
                        // Ensure that set change events are performed if needed.
                        tempignore = false;
                    }
                }
            }
            else if (!button)
            {
                // Ensure that set change events are performed if needed.
                axis->getPAxisButton()->setWhileHeldStatus(false);
                axis->getNAxisButton()->setWhileHeldStatus(false);
            }

            axis->joyEvent(value, tempignore);
        }

        // Activate all dpad buttons in the switched set
        for (int i = 0; i < current_set->getNumberHats(); i++)
        {
            int value = dpadstates.at(i);
            bool tempignore = true;
            JoyDPad *dpad = current_set->getJoyDPad(i);
            JoyDPadButton *button = dpad->getJoyButton(value);
            JoyDPadButton *oldButton = old_set->getJoyDPad(i)->getJoyButton(value);

            if (button && oldButton)
            {
                if (button->getChangeSetCondition() == JoyButton::SetChangeWhileHeld)
                {
                    if (value)
                    {
                        if (oldButton->getChangeSetCondition() == JoyButton::SetChangeWhileHeld && oldButton->getWhileHeldStatus())
                        {
                            // Button from old set involved in a while held set
                            // change. Carry over to new set button to ensure
                            // set changes are done in the proper order.
                            button->setWhileHeldStatus(true);
                        }
                        else if (!button->getWhileHeldStatus())
                        {
                            // Ensure that set change events are performed if needed.
                            tempignore = false;
                        }
                    }
                }
            }
            else if (!button)
            {
                QHashIterator<int, JoyDPadButton*> iter(*dpad->getJoyButtons());
                while (iter.hasNext())
                {
                    // Ensure that set change events are performed if needed.
                    JoyDPadButton *button = iter.next().value();
                    button->setWhileHeldStatus(false);
                }
            }

            dpad->joyEvent(value, tempignore);
        }
    }
}
开发者ID:Xatory,项目名称:antimicro,代码行数:101,代码来源:inputdevice.cpp


注:本文中的JoyDPad::getJoyButtons方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。