MCPcopy Create free account
hub / github.com/axmolengine/axmol / SwitchLight

Method SwitchLight

tests/cpp-tests/Source/LightTest/LightTest.cpp:260–304  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

258}
259
260void LightTest::SwitchLight(Object* sender, LightType lightType)
261{
262 char tmp[32];
263 switch (lightType)
264 {
265 case LightType::AMBIENT:
266 {
267 bool isON = !_ambientLight->isEnabled();
268 auto infoStr = fmt::format_to_z(tmp, "Ambient Light {}", isON == true ? "ON" : "OFF");
269 _ambientLight->setEnabled(isON);
270 _ambientLightLabel->setString(infoStr);
271 }
272 break;
273
274 case LightType::DIRECTIONAL:
275 {
276 bool isON = !_directionalLight->isEnabled();
277 auto infoStr = fmt::format_to_z(tmp, "Directional Light {}", isON == true ? "ON" : "OFF");
278 _directionalLight->setEnabled(isON);
279 _directionalLightLabel->setString(infoStr);
280 }
281 break;
282
283 case LightType::POINT:
284 {
285 bool isON = !_pointLight->isEnabled();
286 auto infoStr = fmt::format_to_z(tmp, "Point Light {}", isON == true ? "ON" : "OFF");
287 _pointLight->setEnabled(isON);
288 _pointLightLabel->setString(infoStr);
289 }
290 break;
291
292 case LightType::SPOT:
293 {
294 bool isON = !_spotLight->isEnabled();
295 auto infoStr = fmt::format_to_z(tmp, "Spot Light {}", isON == true ? "ON" : "OFF");
296 _spotLight->setEnabled(isON);
297 _spotLightLabel->setString(infoStr);
298 }
299 break;
300
301 default:
302 break;
303 }
304}

Callers

nothing calls this directly

Calls 4

format_to_zFunction · 0.85
isEnabledMethod · 0.45
setEnabledMethod · 0.45
setStringMethod · 0.45

Tested by

no test coverage detected