luca00555 wrote:
I’ve been trying really hard but I can’t seem to find a sollution.
I want to initialize SDL in another cpp than the cpp where the drawing is done, how can I create a renderer in for say gfxinit.cpp and pass it on to gfxmain.cpp?
This is not a problem. When you create renderer you got a rendering context variable (a pointer to SDL_Renderer). If you want to use this context in other c/cpp files declare it as a global var or a field of a global structure with “extern” specifier. You can create a header file and declare your rendering context var in this header (something like: extern SDL_Renderer* your_renderer;). Then include this header file to your c/cpp files where you want to use this renderer.