I have a variable in a main.cpp
file like this:
SDL_Renderer* gRenderer = NULL;
and I have a class that is in separate files (a .h
and a .cpp
file).
Inside the .cpp
file I want to access gRenderer
like this:
newTexture = SDL_CreateTextureFromSurface( gRenderer, loadedSurface );
I have tried putting an SDL_Renderer
inside the class but when I compile it gives me only one warning that it is unused and when I run the program I get a message from SDL_GetError() :
"Unable to create texture from colors.png! SDL Error: Invalid renderer"
How can I do that inside the class that is in the separate files?