Michael said:
Well I try to get around this error:
libpng error: Decompression error
which i get at runtime.
Can you say what compiler, linker and debugger you are using?
So i want to move this out of the texture load
function into a init function:
SDL_Surface* lotto[TextureId]
than later the texture load function:
lotto[TextureId] = IMG_Load(TextureFileName)
but now I get at compile:
‘lotto’ was not declared in this scope.
It sounds to me like you want to do something like this:
void someFunction() {
int someVariable;
}
void someOtherFunction() {
someVariable = 5; // someVariable isn't in scope here
}
"lotto" must be declared in the scope in which you intend to use it.
You can consider making it global, but that's probably not a good idea.
You may also consider passing a pointer or reference to "lotto" to the
function you want to use it in.
Was lotto a data member of a class? Are the functions you mentioned
member functions? That would be different.
class SomeClass {
int someVariable;
public:
void someFunction() {
someVariable = -92;
}
};
I'm sorry, but I can't tell what your problem is from the description
you've given. Can you please be more specific?
How should i declare lotto?
I think it's more a question of where, but I'm not really sure. Again,
if you'll please be more specific about the problem you are having, I'm
sure someone will try to give you a more useful answer.
Also please consider,
const int n = 5;
int a[n];
a[n] = 1;
May compile but will not work. In this little code snippet "a" is an
array of five ints and has valid indicies [0,4].
HTH.
LR