I would like to split my game engine in different libraries, so it is easier to maintain, however i have one problem: for example the window creation is handled by GLFW, so I encapsulated it into a class so it will be able to interact with the rest of my library. The problem is that I don't want to make the applications that use my library also depend on GLFW development headers, because otherwise when I pass user input to the application it must know about GLFW and it's data types and has to do something like this:
//Application.cpp
#include<mylibrary.h>
int main()
{
myLibrary::window w("Title", 640, 480)
myLibrary::event e;
while(w.pollEvents(&e))
{
if(e.key == GLFW_KEY_ESCAPE) //Unnecessary GLFW dependancy
w.close();
}
}
Because my header is like this:
//mylibrary.h
#include <glfw/glfw3.h>
namespace myLibrary
{
class window
{
public:
//Blah-blah-blah
private:
//Blah-blah-blah
GLFWwindow* mWindow;
//Blah-blah-blah
};
}
How should I go about abstracting GLFW from the application?
And I cannot use GLFW without wrapping it, because making it interact with the rest of my library ecosystem will look very ugly and out of place, and it would mean that the other libraries not only have to know about the rendering library, but also GLFW.
TL;DR: How can I hide GLFW from the user of my library?