本文整理汇总了C++中JoyDPadButton::getButtonName方法的典型用法代码示例。如果您正苦于以下问题:C++ JoyDPadButton::getButtonName方法的具体用法?C++ JoyDPadButton::getButtonName怎么用?C++ JoyDPadButton::getButtonName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JoyDPadButton
的用法示例。
在下文中一共展示了JoyDPadButton::getButtonName方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: updateSetVDPadButtonNames
void InputDevice::updateSetVDPadButtonNames(int vdpadIndex, int buttonIndex)
{
VDPad *vdpad = getActiveSetJoystick()->getVDPad(vdpadIndex);
if (vdpad)
{
JoyDPadButton *button = vdpad->getJoyButton(buttonIndex);
if (button)
{
setVDPadButtonName(vdpadIndex, buttonIndex, button->getButtonName());
}
}
}
示例2: writeConfig
//.........这里部分代码省略.........
xml->writeEndElement();
}
button = vdpad->getVButton(JoyDPadButton::DpadRight);
if (button)
{
xml->writeStartElement("vdpadButtonAssociation");
if (typeid(*button) == typeid(JoyAxisButton))
{
JoyAxisButton *axisbutton = static_cast<JoyAxisButton*>(button);
xml->writeAttribute("axis", QString::number(axisbutton->getAxis()->getRealJoyIndex()));
xml->writeAttribute("button", QString::number(button->getJoyNumber()));
}
else
{
xml->writeAttribute("axis", QString::number(0));
xml->writeAttribute("button", QString::number(button->getRealJoyNumber()));
}
xml->writeAttribute("direction", QString::number(JoyDPadButton::DpadRight));
xml->writeEndElement();
}
xml->writeEndElement();
}
xml->writeStartElement("names"); // <name>
SetJoystick *tempSet = getActiveSetJoystick();
for (int i=0; i < getNumberButtons(); i++)
{
JoyButton *button = tempSet->getJoyButton(i);
if (button && !button->getButtonName().isEmpty())
{
xml->writeStartElement("buttonname");
xml->writeAttribute("index", QString::number(button->getRealJoyNumber()));
xml->writeCharacters(button->getButtonName());
xml->writeEndElement();
}
}
for (int i=0; i < getNumberAxes(); i++)
{
JoyAxis *axis = tempSet->getJoyAxis(i);
if (axis)
{
if (!axis->getAxisName().isEmpty())
{
xml->writeStartElement("axisname");
xml->writeAttribute("index", QString::number(axis->getRealJoyIndex()));
xml->writeCharacters(axis->getAxisName());
xml->writeEndElement();
}
JoyAxisButton *naxisbutton = axis->getNAxisButton();
if (!naxisbutton->getButtonName().isEmpty())
{
xml->writeStartElement("axisbuttonname");
xml->writeAttribute("index", QString::number(axis->getRealJoyIndex()));
xml->writeAttribute("button", QString::number(naxisbutton->getRealJoyNumber()));
xml->writeCharacters(naxisbutton->getButtonName());
xml->writeEndElement();
}
JoyAxisButton *paxisbutton = axis->getPAxisButton();
示例3: writeConfig
void GameController::writeConfig(QXmlStreamWriter *xml)
{
xml->writeStartElement(getXmlName());
xml->writeAttribute("configversion", QString::number(PadderCommon::LATESTCONFIGFILEVERSION));
xml->writeAttribute("appversion", PadderCommon::programVersion);
xml->writeComment("The SDL name for a joystick is included for informational purposes only.");
xml->writeTextElement("sdlname", getSDLName());
#ifdef USE_SDL_2
xml->writeComment("The GUID for a joystick is included for informational purposes only.");
xml->writeTextElement("guid", getGUIDString());
#endif
if (!profileName.isEmpty())
{
xml->writeTextElement("profilename", profileName);
}
xml->writeStartElement("names"); // <names>
SetJoystick *tempSet = getActiveSetJoystick();
for (int i=0; i < getNumberButtons(); i++)
{
JoyButton *button = tempSet->getJoyButton(i);
if (button && !button->getButtonName().isEmpty())
{
xml->writeStartElement("buttonname");
xml->writeAttribute("index", QString::number(button->getRealJoyNumber()));
xml->writeCharacters(button->getButtonName());
xml->writeEndElement();
}
}
for (int i=0; i < getNumberAxes(); i++)
{
JoyAxis *axis = tempSet->getJoyAxis(i);
if (axis)
{
if (!axis->getAxisName().isEmpty())
{
xml->writeStartElement("axisname");
xml->writeAttribute("index", QString::number(axis->getRealJoyIndex()));
xml->writeCharacters(axis->getAxisName());
xml->writeEndElement();
}
JoyAxisButton *naxisbutton = axis->getNAxisButton();
if (!naxisbutton->getButtonName().isEmpty())
{
xml->writeStartElement("axisbuttonname");
xml->writeAttribute("index", QString::number(axis->getRealJoyIndex()));
xml->writeAttribute("button", QString::number(naxisbutton->getRealJoyNumber()));
xml->writeCharacters(naxisbutton->getButtonName());
xml->writeEndElement();
}
JoyAxisButton *paxisbutton = axis->getPAxisButton();
if (!paxisbutton->getButtonName().isEmpty())
{
xml->writeStartElement("axisbuttonname");
xml->writeAttribute("index", QString::number(axis->getRealJoyIndex()));
xml->writeAttribute("button", QString::number(paxisbutton->getRealJoyNumber()));
xml->writeCharacters(paxisbutton->getButtonName());
xml->writeEndElement();
}
}
}
for (int i=0; i < getNumberSticks(); i++)
{
JoyControlStick *stick = tempSet->getJoyStick(i);
if (stick)
{
if (!stick->getStickName().isEmpty())
{
xml->writeStartElement("controlstickname");
xml->writeAttribute("index", QString::number(stick->getRealJoyIndex()));
xml->writeCharacters(stick->getStickName());
xml->writeEndElement();
}
QHash<JoyControlStick::JoyStickDirections, JoyControlStickButton*> *buttons = stick->getButtons();
QHashIterator<JoyControlStick::JoyStickDirections, JoyControlStickButton*> iter(*buttons);
while (iter.hasNext())
{
JoyControlStickButton *button = iter.next().value();
if (button && !button->getButtonName().isEmpty())
{
xml->writeStartElement("controlstickbuttonname");
xml->writeAttribute("index", QString::number(stick->getRealJoyIndex()));
xml->writeAttribute("button", QString::number(button->getRealJoyNumber()));
xml->writeCharacters(button->getButtonName());
xml->writeEndElement();
}
}
}
}
for (int i=0; i < getNumberVDPads(); i++)
{
//.........这里部分代码省略.........