I'm a newbie in c + +, but I have experience doing simple programs, this is the first time I'm using headers because the program is going to be much bigger than it is right now ... I am following a guide which is this: http://www.sdltutorials.com/sdl-tutorial-basics, I go for the tutorial number 2 this guide is discontinued but im working on it by using SDL 2.0, as I'm using it for the applied logic, and so I sdl learning the basics of a more orderly application of the same.
my problem is this
error: 'gRenderer' was not declared in this scope|
And what it means, is that it has absolutely no knowledge about what gRenderer might be. If you want to use it, you probably should do something like this:
And after fixing this, please, change the way of accessing your data - everything should be hidden behind an interface. One of the reasons is that, if anybody(including you) decides to use this program, and later on, after improving, you want to change the way App works, you may also want to change the way it uses SDL_Renderer(throw it away, get it to other class, and so on). It will force you to make many changes in many places in code, and it's just a gate for a horde of bugs. If you hide it behind some function(e.g. GetRenderer() ), then the only place you have to change code would be the mentioned function. It's really useful sometimes, but you can't appreciate it until you run into described situation :)
And what it means, is that it has absolutely no knowledge about what gRenderer might be. If you want to use it, you probably should do something like this:
And after fixing this, please, change the way of accessing your data - everything should be hidden behind an interface. One of the reasons is that, if anybody(including you) decides to use this program, and later on, after improving, you want to change the way App works, you may also want to change the way it uses SDL_Renderer(throw it away, get it to other class, and so on). It will force you to make many changes in many places in code, and it's just a gate for a horde of bugs. If you hide it behind some function(e.g. GetRenderer() ), then the only place you have to change code would be the mentioned function. It's really useful sometimes, but you can't appreciate it until you run into described situation :)
Anyway, good luck.
Cheers!
i think i got your idea, but thats why i made the CApp_Texture.cpp/h, i think this will be the only function that loads textures to work with, and if i'm in the situation that i got a way to improve it, i'll only code in CApp_Texture.cpp, is that what do you mean?