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

Method SensorManager

src/SFML/Window/SensorManager.cpp:95–122  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

93
94////////////////////////////////////////////////////////////
95SensorManager::SensorManager()
96{
97 // Global sensor initialization
98 SensorImpl::initialize();
99
100 // Per sensor initialization
101 for (unsigned int i = 0; i < Sensor::Count; ++i)
102 {
103 const auto sensor = static_cast<Sensor::Type>(i);
104
105 // Check which sensors are available
106 m_sensors[sensor].available = SensorImpl::isAvailable(sensor);
107
108 // Open the available sensors
109 if (m_sensors[sensor].available)
110 {
111 if (m_sensors[sensor].sensor.open(sensor))
112 {
113 m_sensors[sensor].sensor.setEnabled(false);
114 }
115 else
116 {
117 m_sensors[sensor].available = false;
118 err() << "Warning: sensor " << i << " failed to open, will not be available" << std::endl;
119 }
120 }
121 }
122}
123
124////////////////////////////////////////////////////////////
125SensorManager::~SensorManager()

Callers

nothing calls this directly

Calls 4

initializeFunction · 0.85
isAvailableFunction · 0.70
openMethod · 0.45
setEnabledMethod · 0.45

Tested by

no test coverage detected