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


C++ JoyAxis类代码示例

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


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

示例1: iterAxes

/**
 * @brief Perform a release of all elements of a set. Stick and vdpad
 *     releases will be handled by the associated button or axis.
 */
void SetJoystick::release()
{
    QHashIterator<int, JoyAxis*> iterAxes(axes);
    while (iterAxes.hasNext())
    {
        JoyAxis *axis = iterAxes.next().value();
        axis->clearPendingEvent();
        axis->joyEvent(axis->getCurrentThrottledDeadValue(), true);
    }

    QHashIterator<int, JoyDPad*> iterDPads(hats);
    while (iterDPads.hasNext())
    {
        JoyDPad *dpad = iterDPads.next().value();
        dpad->clearPendingEvent();
        dpad->joyEvent(0, true);
    }

    QHashIterator<int, JoyButton*> iterButtons(buttons);
    while (iterButtons.hasNext())
    {
        JoyButton *button = iterButtons.next().value();
        button->clearPendingEvent();
        button->joyEvent(false, true);
    }
}
开发者ID:jamesblunt,项目名称:antimicro,代码行数:30,代码来源:setjoystick.cpp

示例2: iter

void InputDevice::setAxisButtonName(int axisIndex, int buttonIndex, QString tempName)
{
    QHashIterator<int, SetJoystick*> iter(joystick_sets);
    while (iter.hasNext())
    {
        SetJoystick *tempSet = iter.next().value();
        disconnect(tempSet, SIGNAL(setAxisButtonNameChange(int,int)), this, SLOT(updateSetAxisButtonNames(int,int)));
        JoyAxis *axis = tempSet->getJoyAxis(axisIndex);
        if (axis)
        {
            JoyAxisButton *button = 0;
            if (buttonIndex == 0)
            {
                button = axis->getNAxisButton();
            }
            else if (buttonIndex == 1)
            {
                button = axis->getPAxisButton();
            }

            if (button)
            {
                button->setButtonName(tempName);
            }
        }
        connect(tempSet, SIGNAL(setAxisButtonNameChange(int,int)), this, SLOT(updateSetAxisButtonNames(int,int)));
    }
}
开发者ID:Xatory,项目名称:antimicro,代码行数:28,代码来源:inputdevice.cpp

示例3: propogateSetAxisNameChange

void SetJoystick::propogateSetAxisNameChange()
{
    JoyAxis *axis = static_cast<JoyAxis*>(sender());
    disconnect(axis, SIGNAL(axisNameChanged()), this, SLOT(propogateSetAxisNameChange()));
    emit setAxisNameChange(axis->getIndex());
    connect(axis, SIGNAL(axisNameChanged()), this, SLOT(propogateSetAxisNameChange()));
}
开发者ID:jlsandell,项目名称:antimicro,代码行数:7,代码来源:setjoystick.cpp

示例4: axisIter

/**
 * @brief Raise the dead zones for axes. Used when launching
 *     the controller mapping window.
 */
void SetJoystick::raiseAxesDeadZones(int deadZone)
{
    unsigned int tempDeadZone = deadZone;
    if (deadZone <= 0 || deadZone > 32767)
    {
        tempDeadZone = RAISEDDEADZONE;
    }

    QHashIterator<int, JoyAxis*> axisIter(axes);
    while (axisIter.hasNext())
    {
        JoyAxis *temp = axisIter.next().value();
        temp->disconnectPropertyUpdatedConnection();
        temp->setDeadZone(tempDeadZone);
        temp->establishPropertyUpdatedConnection();
    }

    /*QHashIterator<int, JoyControlStick*> stickIter(sticks);
    while (stickIter.hasNext())
    {
        JoyControlStick *temp = stickIter.next().value();
        temp->disconnectPropertyUpdatedConnection();
        temp->setDeadZone(20000);
        temp->establishPropertyUpdatedConnection();
    }
    */
}
开发者ID:jamesblunt,项目名称:antimicro,代码行数:31,代码来源:setjoystick.cpp

示例5: setAxisThrottle

void SetJoystick::setAxisThrottle(int axisNum, JoyAxis::ThrottleTypes throttle)
{
    if (axes.contains(axisNum))
    {
        JoyAxis *temp = axes.value(axisNum);
        temp->setInitialThrottle(throttle);
    }
}
开发者ID:jamesblunt,项目名称:antimicro,代码行数:8,代码来源:setjoystick.cpp

示例6: getActiveSetJoystick

void InputDevice::updateSetAxisNames(int axisIndex)
{
    JoyAxis *axis = getActiveSetJoystick()->getJoyAxis(axisIndex);
    if (axis)
    {
        setAxisName(axisIndex, axis->getAxisName());
    }
}
开发者ID:Xatory,项目名称:antimicro,代码行数:8,代码来源:inputdevice.cpp

示例7: propogateSetAxisThrottleSetting

void SetJoystick::propogateSetAxisThrottleSetting(int index)
{
    JoyAxis *axis = axes.value(index);
    if (axis)
    {
        emit setAssignmentAxisThrottleChanged(index, axis->getCurrentlyAssignedSet());
    }
}
开发者ID:jlsandell,项目名称:antimicro,代码行数:8,代码来源:setjoystick.cpp

示例8: copyAssignments

void SetJoystick::copyAssignments(SetJoystick *destSet)
{
    for (int i=0; i < device->getNumberAxes(); i++)
    {
        JoyAxis *sourceAxis = axes.value(i);
        JoyAxis *destAxis = destSet->axes.value(i);
        if (sourceAxis && destAxis)
        {
            sourceAxis->copyAssignments(destAxis);
        }
    }

    QHashIterator<int, JoyControlStick*> stickIter(sticks);
    while (stickIter.hasNext())
    {
        stickIter.next();
        int index = stickIter.key();
        JoyControlStick *sourceStick = stickIter.value();
        JoyControlStick *destStick = destSet->sticks.value(index);
        if (sourceStick && destStick)
        {
            sourceStick->copyAssignments(destStick);
        }
    }

    for (int i=0; i < device->getNumberHats(); i++)
    {
        JoyDPad *sourceDPad = hats.value(i);
        JoyDPad *destDPad = destSet->hats.value(i);
        if (sourceDPad && destDPad)
        {
            sourceDPad->copyAssignments(destDPad);
        }
    }

    QHashIterator<int, VDPad*> vdpadIter(vdpads);
    while (vdpadIter.hasNext())
    {
        vdpadIter.next();
        int index = vdpadIter.key();
        VDPad *sourceVDpad = vdpadIter.value();
        VDPad *destVDPad = destSet->vdpads.value(index);
        if (sourceVDpad && destVDPad)
        {
            sourceVDpad->copyAssignments(destVDPad);
        }
    }

    for (int i=0; i < device->getNumberButtons(); i++)
    {
        JoyButton *sourceButton = buttons.value(i);
        JoyButton *destButton = destSet->buttons.value(i);
        if (sourceButton && destButton)
        {
            sourceButton->copyAssignments(destButton);
        }
    }
}
开发者ID:jamesblunt,项目名称:antimicro,代码行数:58,代码来源:setjoystick.cpp

示例9: propogateSetAxisButtonRelease

void SetJoystick::propogateSetAxisButtonRelease(int button)
{
    JoyAxisButton *axisButton = static_cast<JoyAxisButton*>(sender());
    JoyAxis *axis = axisButton->getAxis();
    if (!axisButton->getIgnoreEventState())
    {
        emit setAxisButtonRelease(index, axis->getIndex(), button);
    }
}
开发者ID:jlsandell,项目名称:antimicro,代码行数:9,代码来源:setjoystick.cpp

示例10: iter

bool SetJoystick::isSetEmpty()
{
    bool result = true;
    QHashIterator<int, JoyButton*> iter(buttons);
    while (iter.hasNext() && result)
    {
        JoyButton *button = iter.next().value();
        if (!button->isDefault())
        {
            result = false;
        }
    }

    QHashIterator<int, JoyAxis*> iter2(axes);
    while (iter2.hasNext() && result)
    {
        JoyAxis *axis = iter2.next().value();
        if (!axis->isDefault())
        {
            result = false;
        }
    }

    QHashIterator<int, JoyDPad*> iter3(hats);
    while (iter3.hasNext() && result)
    {
        JoyDPad *dpad = iter3.next().value();
        if (!dpad->isDefault())
        {
            result = false;
        }
    }

    QHashIterator<int, JoyControlStick*> iter4(sticks);
    while (iter4.hasNext() && result)
    {
        JoyControlStick *stick = iter4.next().value();
        if (!stick->isDefault())
        {
            result = false;
        }
    }

    QHashIterator<int, VDPad*> iter5(vdpads);
    while (iter5.hasNext() && result)
    {
        VDPad *vdpad = iter5.next().value();
        if (!vdpad->isDefault())
        {
            result = false;
        }
    }

    return result;
}
开发者ID:jlsandell,项目名称:antimicro,代码行数:55,代码来源:setjoystick.cpp

示例11: getJoyStick

void SetJoystick::writeConfig(QXmlStreamWriter *xml)
{
    if (!isSetEmpty())
    {
        xml->writeStartElement("set");

        xml->writeAttribute("index", QString::number(index+1));

        if (!name.isEmpty())
        {
            xml->writeTextElement("name", name);
        }

        for (int i=0; i < getNumberSticks(); i++)
        {
            JoyControlStick *stick = getJoyStick(i);
            stick->writeConfig(xml);
        }

        for (int i=0; i < getNumberVDPads(); i++)
        {
            VDPad *vdpad = getVDPad(i);
            if (vdpad)
            {
                vdpad->writeConfig(xml);
            }
        }

        for (int i=0; i < getNumberAxes(); i++)
        {
            JoyAxis *axis = getJoyAxis(i);
            if (!axis->isPartControlStick() && axis->hasControlOfButtons())
            {
                axis->writeConfig(xml);
            }
        }

        for (int i=0; i < getNumberHats(); i++)
        {
            JoyDPad *dpad = getJoyDPad(i);
            dpad->writeConfig(xml);
        }

        for (int i=0; i < getNumberButtons(); i++)
        {
            JoyButton *button = getJoyButton(i);
            if (button && !button->isPartVDPad())
            {
                button->writeConfig(xml);
            }
        }

        xml->writeEndElement();
    }
}
开发者ID:jamesblunt,项目名称:antimicro,代码行数:55,代码来源:setjoystick.cpp

示例12: tempStatus

QBitArray InputDaemon::createUnplugEventBitArray(InputDevice *device)
{
    InputDeviceBitArrayStatus tempStatus(device, false);

    for (int i=0; i < device->getNumberRawAxes(); i++)
    {
        JoyAxis *axis = device->getActiveSetJoystick()->getJoyAxis(i);
        if (axis && axis->getThrottle() != JoyAxis::NormalThrottle)
        {
            tempStatus.changeAxesStatus(i, true);
        }
    }

    QBitArray unplugBitArray = tempStatus.generateFinalBitArray();
    return unplugBitArray;
}
开发者ID:AdriiSixx,项目名称:antimicro,代码行数:16,代码来源:inputdaemon.cpp

示例13: iter

void SetJoystick::setAxesDeadZones(QList<int> *axesDeadZones)
{
    QListIterator<int> iter(*axesDeadZones);
    int axisNum = 0;
    while (iter.hasNext())
    {
        int deadZoneValue = iter.next();
        if (axes.contains(axisNum))
        {
            JoyAxis *temp = getJoyAxis(axisNum);
            temp->disconnectPropertyUpdatedConnection();
            temp->setDeadZone(deadZoneValue);
            temp->establishPropertyUpdatedConnection();
        }

        axisNum++;
    }
}
开发者ID:jamesblunt,项目名称:antimicro,代码行数:18,代码来源:setjoystick.cpp

示例14: deleteAxes

void SetJoystick::refreshAxes()
{
    deleteAxes();

    InputDevice *device = getInputDevice();
    for (int i=0; i < device->getNumberRawAxes(); i++)
    {
        JoyAxis *axis = new JoyAxis(i, index, this, this);
        axes.insert(i, axis);

        if (device->hasCalibrationThrottle(i))
        {
            JoyAxis::ThrottleTypes throttle = device->getCalibrationThrottle(i);
            axis->setInitialThrottle(throttle);
        }

        enableAxisConnections(axis);
    }
}
开发者ID:jamesblunt,项目名称:antimicro,代码行数:19,代码来源:setjoystick.cpp

示例15: 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++)
    {
//.........这里部分代码省略.........
开发者ID:jamesblunt,项目名称:antimicro,代码行数:101,代码来源:gamecontroller.cpp


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