I am having problems with the following few lines of code. The first time through the
outer while loop, everything is rendered properly. My image (gps_map) is displayed, and
if I add any text to the buffer (buffer) beforehand, it is displayed. However, when I
handle an event that adds text to the buffer, setting the dirty flag to true, the program
seg faults on the SDL_Flip(screen) call. I know that screen is not null because I tested
it just before the call that seg faults. What am I missing here?
while(!done){
if(dirty){
SDL_Rect dest;
dest.x = 52;
dest.y = 20;
dest.w = gps_map->w;
dest.h = gps_map->h;
SDL_BlitSurface(gps_map, NULL, screen, &dest);
dest.x = 0;
dest.y = 0;
text = TTF_RenderText_Solid(font, buffer->getBuffer(), white);
SDL_BlitSurface(text, NULL, screen, &dest);
SDL_FreeSurface(text);
SDL_Flip(screen);
dirty = false;
}
// Handle events . . . set dirty flag if event changes display
.
.
.
}//end while
Christian