MCPcopy Create free account
hub / github.com/SFML/SFML / update

Method update

src/SFML/Window/JoystickManager.cpp:68–102  ·  view source on GitHub ↗

///////////////////////////////////////////////////////

Source from the content-addressed store, hash-verified

66
67////////////////////////////////////////////////////////////
68void 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////////////////////////////////////////////////////////////

Callers

nothing calls this directly

Calls 7

JoystickCapsClass · 0.85
JoystickStateClass · 0.85
isConnectedFunction · 0.85
closeMethod · 0.45
openMethod · 0.45
getCapabilitiesMethod · 0.45
getIdentificationMethod · 0.45

Tested by

no test coverage detected