Thanks for the reply. Right, I want the address of the SDL_Rect. (note, i already recognize an error where I am no longer initializing gr->tower, instead im initializing gr->flora[1]
ok First of all I have a stuct for the overall game resources. Ill add comments here.
Code:
typedef struct s_gameresources {
SDL_Surface *screen;
SDL_Surface *invscreen;
SDL_Surface *temp;
SDL_Surface *sprite;
SDL_Surface *grass;
SDL_Surface *actionBar;
SDL_Surface *geographic_map;
SDL_Surface *tower;
SDL_Surface *seltarget;
SDL_Surface *flora[200]; //I am trying to put all static objects like the "tower" and tree here.
SDL_Surface *tiles[200];
SDL_Rect rcSprite, rcGrass, rcactionBar, rctower, rcMap, rcInv;
SDL_Rect rcFlora[200]; //Rectangles for the tower.
SDL_Event event;
} GameRes;
Next, I have a function called LoadResouces which basically initializes the struct, making surfaces of all the images and their corresponding rectangles.
//Before that I have a memory allocation in main()
gr = (GameRes *) malloc(sizeof(GameRes));
LoadResources(gr, scrmode);
I have certain rectangles still declared in main() which work fine
rcGrass.x = 800; rcGrass.y = 600;
//rctower.x = 600; rctower.y = 128;
rcInv.x = 800; rcInv.y = 600;
rcactionBar.x = 0;
rcactionBar.y = 0; sheight = 32;
Im guessing SDL_Rect is a struct, so its a array of struct within a struct?
HEre is something else. In the case of my "floor tiles", i have declared rcTiles[200][200] but as global within main's C file, and if I do a
SDL_BlitSurface(gr->tiles[0], NULL, screen, &rcTiles[y][x]);
it works fine.