My problem is that I have a
global_variables.h file which needs to know about the files :
- Debugger.h
- Window.h
- Input.h
My problem is that Input.h needs to know about Window.h, and needs to use several of it's functions and therefore it also needs the global_variables.h file, and now I have ran into a circular dependency.
The reason I'm using a Global_Variables.h file is because I knew many files would need to access my different game engine components, so I threw them into the Global_Variables.h file, which seemed like a good idea at first.¨
But, since I'm a beginner i didn't think of this problem that I'm now facing. :/
Here's some code examples :
Global_Variables.h :
#pragma once
#include "Debugger.h"
#include "Window.h"
#include "Input.h"
static const std::string GAME_NAME = "SwEngine Testing";
static Debugger global_debugger;
static Window global_window;
static Input global_input;
And the input class is newly created, only has a destructor and a constructor as well as some comments.
So, how should I go about solving this problem? :)
What I have tried:
Have tried googling but haven't really found any good answers on how to solve the problem.
So, I have not really tried anything yet.