I have a game class as follows:
// game.h
class Game {
public:
void Run();
void CleanUp();
}
I want to create a texture pointer which is declared here, but initiated at construction. This pointer is to a type that exists in a third party header file:
private:
std::unique_ptr<Texture> sprite_sheet; // Texture is in game_engine.h which is third party.
The problem is, if I #include "game_engine.h"
in this header, then every file that includes this header will include everything from game_engine
as well which I want to avoid. Ideally, I would only like to include game_engine
in the source file (.cpp
).
Is there a standard design pattern to help me avoid this?
One way is to create my own Texture
class which only exposes the relevant parts I want. But this will slowly blow out of proportion as I will have to re-do my own classes for everything.