I am asking myself, how you would achieve something in a game engine, where a user just defines one class and can compile. Maybe let me elaborate with some code, this would just be what the user of the game engine does:
#include <engine.h>
class game : engine::application
{
void main_loop() override;
void initialize() override;
void destruct() override;
};
how would i achieve it, that the game engine could be compiled into a library or package of sorts, with the engine still being able to access an instance or something like the singleton of this game class. So first youd compile the engine, and then be able to use it with your game.
I've tried a method using the extern
keyword where the user just defines a function like this:
engine::application* get_game() {return new game();}
but its quite messy to use, like i dont know why but you have to write code that uses this function in a header file, cause when you compile the code in a source file, it would not know of this function and say undefined and something. I also tried some research, but really found nothing on this topic.