本文整理汇总了C++中JoyControlStickButton类的典型用法代码示例。如果您正苦于以下问题:C++ JoyControlStickButton类的具体用法?C++ JoyControlStickButton怎么用?C++ JoyControlStickButton使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了JoyControlStickButton类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: propogateSetStickButtonNameChange
void SetJoystick::propogateSetStickButtonNameChange()
{
JoyControlStickButton *button = static_cast<JoyControlStickButton*>(sender());
disconnect(button, SIGNAL(buttonNameChanged()), this, SLOT(propogateSetStickButtonNameChange()));
emit setStickButtonNameChange(button->getStick()->getIndex(), button->getJoyNumber());
connect(button, SIGNAL(buttonNameChanged()), this, SLOT(propogateSetStickButtonNameChange()));
}
示例2: getApplicableButtons
bool JoyControlStick::getButtonsPresetSmoothing()
{
bool presetSmoothing = false;
QHash<JoyStickDirections, JoyControlStickButton*> temphash = getApplicableButtons();
QHashIterator<JoyStickDirections, JoyControlStickButton*> iter(temphash);
while (iter.hasNext())
{
if (!iter.hasPrevious())
{
JoyControlStickButton *button = iter.next().value();
presetSmoothing = button->isSmoothingEnabled();
}
else
{
JoyControlStickButton *button = iter.next().value();
bool temp = button->isSmoothingEnabled();
if (temp != presetSmoothing)
{
presetSmoothing = false;
iter.toBack();
}
}
}
return presetSmoothing;
}
示例3: iter
void JoyControlStickEditDialogHelper::setFromPendingSlots()
{
if (!pendingSlots.isEmpty())
{
QHashIterator<JoyControlStick::JoyStickDirections, JoyButtonSlot*> iter(pendingSlots);
while (iter.hasNext())
{
iter.next();
JoyButtonSlot *slot = iter.value();
if (slot)
{
JoyControlStick::JoyStickDirections tempDir = iter.key();
JoyControlStickButton *button = stick->getDirectionButton(tempDir);
if (button)
{
button->clearSlotsEventReset(false);
button->setAssignedSlot(slot->getSlotCode(), slot->getSlotCodeAlias(),
slot->getSlotMode());
}
slot->deleteLater();
}
}
}
}
示例4: changeSetStickButtonAssociation
void InputDevice::changeSetStickButtonAssociation(int button_index, int stick_index, int originset, int newset, int mode)
{
JoyControlStickButton *button = joystick_sets.value(newset)->getJoyStick(stick_index)->getDirectionButton((JoyControlStick::JoyStickDirections)button_index);
JoyButton::SetChangeCondition tempmode = (JoyButton::SetChangeCondition)mode;
button->setChangeSetSelection(originset);
button->setChangeSetCondition(tempmode, true);
}
示例5: iter
void JoyControlStick::setButtonsSensitivity(double value)
{
QHashIterator<JoyStickDirections, JoyControlStickButton*> iter(buttons);
while (iter.hasNext())
{
JoyControlStickButton *button = iter.next().value();
button->setSensitivity(value);
}
}
示例6: propogateSetStickButtonRelease
void SetJoystick::propogateSetStickButtonRelease(int button)
{
JoyControlStickButton *stickButton = static_cast<JoyControlStickButton*>(sender());
JoyControlStick *stick = stickButton->getStick();
if (!stickButton->getIgnoreEventState())
{
emit setStickButtonRelease(index, stick->getIndex(), button);
}
}
示例7: iter
void MouseControlStickSettingsDialog::updateConfigVerticalSpeed(int value)
{
QHashIterator<JoyControlStick::JoyStickDirections, JoyControlStickButton*> iter(*stick->getButtons());
while (iter.hasNext())
{
JoyControlStickButton *button = iter.next().value();
button->setMouseSpeedY(value);
}
}
示例8: while
void JoyControlStick::readConfig(QXmlStreamReader *xml)
{
if (xml->isStartElement() && xml->name() == "stick")
{
xml->readNextStartElement();
while (!xml->atEnd() && (!xml->isEndElement() && xml->name() != "stick"))
{
if (xml->name() == "deadZone" && xml->isStartElement())
{
QString temptext = xml->readElementText();
int tempchoice = temptext.toInt();
this->setDeadZone(tempchoice);
}
else if (xml->name() == "maxZone" && xml->isStartElement())
{
QString temptext = xml->readElementText();
int tempchoice = temptext.toInt();
this->setMaxZone(tempchoice);
}
else if (xml->name() == "diagonalRange" && xml->isStartElement())
{
QString temptext = xml->readElementText();
int tempchoice = temptext.toInt();
this->setDiagonalRange(tempchoice);
}
else if (xml->name() == "mode" && xml->isStartElement())
{
QString temptext = xml->readElementText();
if (temptext == "eight-way")
{
this->setJoyMode(EightWayMode);
}
}
else if (xml->name() == JoyControlStickButton::xmlName && xml->isStartElement())
{
int index = xml->attributes().value("index").toString().toInt();
JoyControlStickButton *button = buttons.value((JoyStickDirections)index);
if (button)
{
button->readConfig(xml);
}
else
{
xml->skipCurrentElement();
}
}
else
{
xml->skipCurrentElement();
}
xml->readNextStartElement();
}
}
}
示例9: getActiveSetJoystick
void InputDevice::updateSetStickButtonNames(int stickIndex, int buttonIndex)
{
JoyControlStick *stick = getActiveSetJoystick()->getJoyStick(stickIndex);
if (stick)
{
JoyControlStickButton *button = stick->getDirectionButton(JoyControlStick::JoyStickDirections(buttonIndex));
if (button)
{
setStickButtonName(stickIndex, buttonIndex, button->getButtonName());
}
}
}
示例10: iter
void InputDevice::setStickButtonName(int stickIndex, int buttonIndex, QString tempName)
{
QHashIterator<int, SetJoystick*> iter(joystick_sets);
while (iter.hasNext())
{
SetJoystick *tempSet = iter.next().value();
disconnect(tempSet, SIGNAL(setStickButtonNameChange(int,int)), this, SLOT(updateSetStickButtonNames(int,int)));
JoyControlStick *stick = tempSet->getJoyStick(stickIndex);
if (stick)
{
JoyControlStickButton *button = stick->getDirectionButton(JoyControlStick::JoyStickDirections(buttonIndex));
if (button)
{
button->setButtonName(tempName);
}
}
connect(tempSet, SIGNAL(setStickButtonNameChange(int,int)), this, SLOT(updateSetStickButtonNames(int,int)));
}
}
示例11: getSDLName
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++)
{
//.........这里部分代码省略.........
示例12: getPartialName
QString JoyControlStick::getName(bool forceFullFormat, bool displayNames)
{
QString label = getPartialName(forceFullFormat, displayNames);
label.append(": ");
QStringList tempList;
if (buttons.contains(StickUp))
{
JoyControlStickButton *button = buttons.value(StickUp);
if (!button->getButtonName().isEmpty())
{
tempList.append(button->getButtonName());
}
else
{
tempList.append(button->getSlotsSummary());
}
}
if (buttons.contains(StickLeft))
{
JoyControlStickButton *button = buttons.value(StickLeft);
if (!button->getButtonName().isEmpty())
{
tempList.append(button->getButtonName());
}
else
{
tempList.append(button->getSlotsSummary());
}
}
if (buttons.contains(StickDown))
{
JoyControlStickButton *button = buttons.value(StickDown);
if (!button->getButtonName().isEmpty())
{
tempList.append(button->getButtonName());
}
else
{
tempList.append(button->getSlotsSummary());
}
}
if (buttons.contains(StickRight))
{
JoyControlStickButton *button = buttons.value(StickRight);
if (!button->getButtonName().isEmpty())
{
tempList.append(button->getButtonName());
}
else
{
tempList.append(button->getSlotsSummary());
}
}
label.append(tempList.join(", "));
return label;
}
示例13: getPresetIndex
int JoyControlStickContextMenu::getPresetIndex()
{
int result = 0;
JoyControlStickButton *upButton = stick->getDirectionButton(JoyControlStick::StickUp);
QList<JoyButtonSlot*> *upslots = upButton->getAssignedSlots();
JoyControlStickButton *downButton = stick->getDirectionButton(JoyControlStick::StickDown);
QList<JoyButtonSlot*> *downslots = downButton->getAssignedSlots();
JoyControlStickButton *leftButton = stick->getDirectionButton(JoyControlStick::StickLeft);
QList<JoyButtonSlot*> *leftslots = leftButton->getAssignedSlots();
JoyControlStickButton *rightButton = stick->getDirectionButton(JoyControlStick::StickRight);
QList<JoyButtonSlot*> *rightslots = rightButton->getAssignedSlots();
if (upslots->length() == 1 && downslots->length() == 1 && leftslots->length() == 1 && rightslots->length() == 1)
{
JoyButtonSlot *upslot = upslots->at(0);
JoyButtonSlot *downslot = downslots->at(0);
JoyButtonSlot *leftslot = leftslots->at(0);
JoyButtonSlot *rightslot = rightslots->at(0);
if (upslot->getSlotMode() == JoyButtonSlot::JoyMouseMovement && upslot->getSlotCode() == JoyButtonSlot::MouseUp &&
downslot->getSlotMode() == JoyButtonSlot::JoyMouseMovement && downslot->getSlotCode() == JoyButtonSlot::MouseDown &&
leftslot->getSlotMode() == JoyButtonSlot::JoyMouseMovement && leftslot->getSlotCode() == JoyButtonSlot::MouseLeft &&
rightslot->getSlotMode() == JoyButtonSlot::JoyMouseMovement && rightslot->getSlotCode() == JoyButtonSlot::MouseRight)
{
result = 1;
}
else if (upslot->getSlotMode() == JoyButtonSlot::JoyMouseMovement && upslot->getSlotCode() == JoyButtonSlot::MouseUp &&
downslot->getSlotMode() == JoyButtonSlot::JoyMouseMovement && downslot->getSlotCode() == JoyButtonSlot::MouseDown &&
leftslot->getSlotMode() == JoyButtonSlot::JoyMouseMovement && leftslot->getSlotCode() == JoyButtonSlot::MouseRight &&
rightslot->getSlotMode() == JoyButtonSlot::JoyMouseMovement && rightslot->getSlotCode() == JoyButtonSlot::MouseLeft)
{
result = 2;
}
else if (upslot->getSlotMode() == JoyButtonSlot::JoyMouseMovement && upslot->getSlotCode() == JoyButtonSlot::MouseDown &&
downslot->getSlotMode() == JoyButtonSlot::JoyMouseMovement && downslot->getSlotCode() == JoyButtonSlot::MouseUp &&
leftslot->getSlotMode() == JoyButtonSlot::JoyMouseMovement && leftslot->getSlotCode() == JoyButtonSlot::MouseLeft &&
rightslot->getSlotMode() == JoyButtonSlot::JoyMouseMovement && rightslot->getSlotCode() == JoyButtonSlot::MouseRight)
{
result = 3;
}
else if (upslot->getSlotMode() == JoyButtonSlot::JoyMouseMovement && upslot->getSlotCode() == JoyButtonSlot::MouseDown &&
downslot->getSlotMode() == JoyButtonSlot::JoyMouseMovement && downslot->getSlotCode() == JoyButtonSlot::MouseUp &&
leftslot->getSlotMode() == JoyButtonSlot::JoyMouseMovement && leftslot->getSlotCode() == JoyButtonSlot::MouseRight &&
rightslot->getSlotMode() == JoyButtonSlot::JoyMouseMovement && rightslot->getSlotCode() == JoyButtonSlot::MouseLeft)
{
result = 4;
}
else if (upslot->getSlotMode() == JoyButtonSlot::JoyKeyboard && (unsigned int)upslot->getSlotCode() == AntKeyMapper::getInstance()->returnVirtualKey(Qt::Key_Up) &&
downslot->getSlotMode() == JoyButtonSlot::JoyKeyboard && (unsigned int)downslot->getSlotCode() == AntKeyMapper::getInstance()->returnVirtualKey(Qt::Key_Down) &&
leftslot->getSlotMode() == JoyButtonSlot::JoyKeyboard && (unsigned int)leftslot->getSlotCode() == AntKeyMapper::getInstance()->returnVirtualKey(Qt::Key_Left) &&
rightslot->getSlotMode() == JoyButtonSlot::JoyKeyboard && (unsigned int)rightslot->getSlotCode() == AntKeyMapper::getInstance()->returnVirtualKey(Qt::Key_Right))
{
result = 5;
}
else if (upslot->getSlotMode() == JoyButtonSlot::JoyKeyboard && (unsigned int)upslot->getSlotCode() == AntKeyMapper::getInstance()->returnVirtualKey(Qt::Key_W) &&
downslot->getSlotMode() == JoyButtonSlot::JoyKeyboard && (unsigned int)downslot->getSlotCode() == AntKeyMapper::getInstance()->returnVirtualKey(Qt::Key_S) &&
leftslot->getSlotMode() == JoyButtonSlot::JoyKeyboard && (unsigned int)leftslot->getSlotCode() == AntKeyMapper::getInstance()->returnVirtualKey(Qt::Key_A) &&
rightslot->getSlotMode() == JoyButtonSlot::JoyKeyboard && (unsigned int)rightslot->getSlotCode() == AntKeyMapper::getInstance()->returnVirtualKey(Qt::Key_D))
{
result = 6;
}
else if (upslot->getSlotMode() == JoyButtonSlot::JoyKeyboard && (unsigned int)upslot->getSlotCode() == AntKeyMapper::getInstance()->returnVirtualKey(QtKeyMapperBase::AntKey_KP_8) &&
downslot->getSlotMode() == JoyButtonSlot::JoyKeyboard && (unsigned int)downslot->getSlotCode() == AntKeyMapper::getInstance()->returnVirtualKey(QtKeyMapperBase::AntKey_KP_2) &&
leftslot->getSlotMode() == JoyButtonSlot::JoyKeyboard && (unsigned int)leftslot->getSlotCode() == AntKeyMapper::getInstance()->returnVirtualKey(QtKeyMapperBase::AntKey_KP_4) &&
rightslot->getSlotMode() == JoyButtonSlot::JoyKeyboard && (unsigned int)rightslot->getSlotCode() == AntKeyMapper::getInstance()->returnVirtualKey(QtKeyMapperBase::AntKey_KP_6))
{
result = 7;
}
}
else if (upslots->length() == 0 && downslots->length() == 0 && leftslots->length() == 0 && rightslots->length() == 0)
{
result = 8;
}
return result;
}
示例14: getSDLName
//.........这里部分代码省略.........
{
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 < getNumberHats(); i++)
{
JoyDPad *dpad = tempSet->getJoyDPad(i);
if (dpad)
{
if (!dpad->getDpadName().isEmpty())
{
xml->writeStartElement("dpadname");
xml->writeAttribute("index", QString::number(dpad->getRealJoyNumber()));
xml->writeCharacters(dpad->getDpadName());
xml->writeEndElement();
}
QHash<int, JoyDPadButton*> *temp = dpad->getButtons();
QHashIterator<int, JoyDPadButton*> iter(*temp);
while (iter.hasNext())
示例15: iter
void SetJoystick::setIgnoreEventState(bool ignore)
{
QHashIterator<int, JoyButton*> iter(buttons);
while (iter.hasNext())
{
JoyButton *button = iter.next().value();
if (button)
{
button->setIgnoreEventState(ignore);
}
}
QHashIterator<int, JoyAxis*> iter2(axes);
while (iter2.hasNext())
{
JoyAxis *axis = iter2.next().value();
if (axis)
{
JoyAxisButton *naxisbutton = axis->getNAxisButton();
naxisbutton->setIgnoreEventState(ignore);
JoyAxisButton *paxisbutton = axis->getPAxisButton();
paxisbutton->setIgnoreEventState(ignore);
}
}
QHashIterator<int, JoyDPad*> iter3(hats);
while (iter3.hasNext())
{
JoyDPad *dpad = iter3.next().value();
if (dpad)
{
QHash<int, JoyDPadButton*>* dpadbuttons = dpad->getButtons();
QHashIterator<int, JoyDPadButton*> iterdpadbuttons(*dpadbuttons);
while (iterdpadbuttons.hasNext())
{
JoyDPadButton *dpadbutton = iterdpadbuttons.next().value();
if (dpadbutton)
{
dpadbutton->setIgnoreEventState(ignore);
}
}
}
}
QHashIterator<int, JoyControlStick*> iter4(sticks);
while (iter4.hasNext())
{
JoyControlStick *stick = iter4.next().value();
if (stick)
{
QHash<JoyControlStick::JoyStickDirections, JoyControlStickButton*> *stickButtons = stick->getButtons();
QHashIterator<JoyControlStick::JoyStickDirections, JoyControlStickButton*> iterstickbuttons(*stickButtons);
while (iterstickbuttons.hasNext())
{
JoyControlStickButton *stickbutton = iterstickbuttons.next().value();
stickbutton->setIgnoreEventState(ignore);
}
}
}
QHashIterator<int, VDPad*> iter5(vdpads);
while (iter5.hasNext())
{
VDPad *vdpad = iter5.next().value();
if (vdpad)
{
QHash<int, JoyDPadButton*>* dpadbuttons = vdpad->getButtons();
QHashIterator<int, JoyDPadButton*> itervdpadbuttons(*dpadbuttons);
while (itervdpadbuttons.hasNext())
{
JoyDPadButton *dpadbutton = itervdpadbuttons.next().value();
dpadbutton->setIgnoreEventState(ignore);
}
}
}
}