Esempio n. 1
0
void Gamepad::getJoystickValues(unsigned int joystickId, kmVec2* outValue) const
{
    if (joystickId >= _joystickCount)
        return;

    if (_form)
    {
        JoystickControl* joystick = _uiJoysticks[joystickId];
        if (joystick)
        {
            const kmVec2& value = joystick->getValue();
            //outValue->set(value.x, value.y);
			kmVec2Fill(outValue, value.x, value.y);
        }
        else
        {
            //outValue->set(0.0f, 0.0f);
			kmVec2Fill(outValue, 0.0f, 0.0f);
        }
    }
    else
    {
        //outValue->set(_joysticks[joystickId]);
		kmVec2Fill(outValue, _joysticks[joystickId].x, _joysticks[joystickId].y);
    }
}
Esempio n. 2
0
void Gamepad::getJoystickValues(unsigned int joystickId, Vector2* outValue) const
{
    if (joystickId >= _joystickCount)
        return;

    if (_form)
    {
        JoystickControl* joystick = _uiJoysticks[joystickId];
        if (joystick)
        {
            const Vector2& value = joystick->getValue();
            outValue->set(value.x, value.y);
        }
        else
        {
            outValue->set(0.0f, 0.0f);
        }
    }
    else
    {
        outValue->set(_joysticks[joystickId]);
    }
}