O'Reilly logo

Mastering SFML Game Development by Raimondas Pupius

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Integrating the changes made

Finally, all we have left to do in order to make this work is add the newly created component and system types to the ECS:

void Game::SetUpECS() { 
  ... 
  m_entityManager->AddComponentType<C_ShadowCaster> 
    (Component::ShadowCaster); 
  ... 
  m_systemManager->AddSystem<S_Shadow>(System::Shadow); 
  ... 
  m_systemManager->GetSystem<S_Shadow>(System::Shadow)-> 
    SetLightManager(m_lightManager.get()); 
} 

The shadow system itself also needs a pointer to the light manager for obvious reasons. Running the game now, with all of the lights properly set up and shadow casters correctly loaded, we should have three-dimensional shadows!

Integrating the changes made

Because the ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required