i'm trying to build a 2D game engine on top of SDL.
In my "engine" folder i have a file called my.h
which is what i expect the end user to include in his program
it looks like this:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
#pragma once
#include <stdafx.h>
#include <cstdio>
#include <SDL.h> //cant do this as it would require the end user to add SDL headers to his project
namespace My
{
class DECLSPEC MyGame
{
private:
SDLWindow* m_pSDLWindow; //problem is here
public:
MyGame();
void AddScene();
void Start();
};
}
the problem is that, the "myGame" class needs to have a pointer to an SDL window
but if i include the SDL header then the end user of my engine will have to install and add the SDL headers to his project as well. which i dont want.
I just want the end user to install and link against my dll and headers, only.
For a pointer you can always have a forward reference (like struct SDLWindow;). Then including the sdl header wouldn't be necessary. Any use regarding that object needs to be done within your dll.
You might want to wrap those pointer in your own class/struct.