# Where to put SFML Window in GameStateManager

I have a Pong game using SFML organized after this tutorial.

This is the UML diagram from the tutorial.

Now I am not sure where I should put my SFML RenderWindow variable (and other things that might need to be shared between game states.

I have a PlayingGameState with a shared_ptr to a GameStateManager. So the right place should be the GameStateManager class. Or should I put it into the DirectRenderingGameStateManager and change the shared_ptr to DirectRenderingGameStateManager?

The instance of your sf::RenderWindow should go in your DirectRenderingGameStateManager. You have it marked as <<interface>> in your diagram but you've given it variables, so I'm assuming it's really an abstract (or concrete?) class. Either way, there's no reason for it to go in GameStateManager as that interface has no correlation to graphics.
Generally, place things as low as possible in your inheritance tree and as high as needed. That is: No reason for GameStateManager to know anything about the RenderWindow, but sharing it netween all your Drawables is asking for trouble.
• So the PlayingGameState should have a shared_ptr to DirectRenderingGameStateManager instead of GameStateManager ? Thanks for your answer and sorry for my long delay. – Philipp Löwen Nov 18 '16 at 9:32