Well i will post some code but first an explanation of why.
I want to have images display a count of for instance bullets that the player has in his clip.
But I also want it centered within an SDL_Rect and I already have a function for getting a surface centered withing a Rect.
And the only way I can think of doing that is blitting as many images I need to a buffer and then center blitting the buffer.
But here's the problem:
Code: Select all
//SDL_Rect temp;
//SDL_Surface *dataType;
//SDL_Surface *dataBuffer;
//int dataNum;
//dataType is loaded with the image to display and dataNum is passed a number in the update function.
for( int i = 0; i < dataNum - 1; i++ )
{
temp.x = 0 + ( dataType->w * i );
temp.y = 0;
SDL_BlitSurface( dataType, NULL, dataBuffer, temp );
}
When I try to do that it fives me some error.
I hope my response was adequate.