Hello,
I'm in the middle of trying to make a simple game. I wanted to make a structure, which would contain every SDL_Rect object that needs to be displayed somewhere.
The problem is, I'm not sure if I can even do such thing.
What I have below is declared as a global variable:
I don't want to use this as globals, because it messes things up - that's why I wanted to make a structure, which I could pass through functions from main().
For example:
1 2 3 4 5 6 7
struct my_Rect{
SDL_Rect mapRect;
SDL_Rect windowRect = { 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT}; //this should be initialised somewhere else, I know - but let's leave it as another problem
SDL_Rect frogRect;
SDL_Rect car1Rect;
SDL_Rect car2Rect;
};
I don't know why I thought about structures - arrays seems easier, thanks. I'll try to implement it.
I'm writing in C and C++, but mostly just using SDL functions