Ejemplo n.º 1
0
void Gamepad::updateFromPlatformGamepad(const PlatformGamepad& platformGamepad)
{
    for (unsigned i = 0; i < m_axes.size(); ++i)
        m_axes[i] = platformGamepad.axisValues()[i];
    for (unsigned i = 0; i < m_buttons.size(); ++i)
        m_buttons[i]->setValue(platformGamepad.buttonValues()[i]);

    m_timestamp = platformGamepad.lastUpdateTime();
}
Ejemplo n.º 2
0
Gamepad::Gamepad(const PlatformGamepad& platformGamepad)
    : m_id(platformGamepad.id())
    , m_index(platformGamepad.index())
    , m_connected(true)
    , m_timestamp(platformGamepad.lastUpdateTime())
    , m_axes(platformGamepad.axisValues().size(), 0.0)
{
    unsigned buttonCount = platformGamepad.buttonValues().size();
    for (unsigned i = 0; i < buttonCount; ++i)
        m_buttons.append(GamepadButton::create());
}