///////////////////////////////////////////////////////
| 66 | |
| 67 | //////////////////////////////////////////////////////////// |
| 68 | void JoystickManager::update() |
| 69 | { |
| 70 | for (unsigned int i = 0; i < Joystick::Count; ++i) |
| 71 | { |
| 72 | Item& item = m_joysticks[i]; |
| 73 | |
| 74 | if (item.state.connected) |
| 75 | { |
| 76 | // Get the current state of the joystick |
| 77 | item.state = item.joystick.update(); |
| 78 | |
| 79 | // Check if it's still connected |
| 80 | if (!item.state.connected) |
| 81 | { |
| 82 | item.joystick.close(); |
| 83 | item.capabilities = JoystickCaps(); |
| 84 | item.state = JoystickState(); |
| 85 | item.identification = Joystick::Identification(); |
| 86 | } |
| 87 | } |
| 88 | else |
| 89 | { |
| 90 | // Check if the joystick was connected since last update |
| 91 | if (JoystickImpl::isConnected(i)) |
| 92 | { |
| 93 | if (item.joystick.open(i)) |
| 94 | { |
| 95 | item.capabilities = item.joystick.getCapabilities(); |
| 96 | item.state = item.joystick.update(); |
| 97 | item.identification = item.joystick.getIdentification(); |
| 98 | } |
| 99 | } |
| 100 | } |
| 101 | } |
| 102 | } |
| 103 | |
| 104 | |
| 105 | //////////////////////////////////////////////////////////// |
nothing calls this directly
no test coverage detected