Original Post
Hey everyone. I'm working on a game project using SDL and Dev-C++. I'm learning from the Cone3D tutorials, but I'm having a problem I can't seem to solve. The goal of this part of the program is to copy a portion of the screen surface and draw it in another location. However, whenever I run the program, it doesn't seem to copy anything from screen to testbox. I can blit other images onto the screen, but I can't find a successful way to copy from one part of the screen to another part. I am including part of the code below. The line that doesn't seem to function as I would like has been marked with an appropriate comment. I've tried to debug that line by using "if (SDL_BlitSurface... )". It returns zero (successful blit, as far as I know) each time. If anyone has a way I could fix this, I would certainly appreciate it. Benjamin Stauffer (kcowolf@gmail.com) Computer Science University of Missouri-Rolla --- Begin portion of code: screen=SDL_SetVideoMode(800,600,32,SDL_SWSURFACE|SDL_RESIZABLE|SDL_HWPALETTE); SDL_Surface *back, *temp1, *temp2; temp1 = SDL_LoadBMP("back.bmp"); temp2 = SDL_DisplayFormat(temp1); SDL_FreeSurface(temp1); back = temp2; SDL_Rect backdest; backdest.x = 0; backdest.y = 0; SDL_BlitSurface(back, NULL, screen, &backdest); *snip* SDL_Surface *testbox; SDL_Rect src; src.x = 400; src.y = 200; src.w = 50; src.h = 50; SDL_Rect dest; dest.x = 0; dest.y = 0; SDL_BlitSurface(screen, &src, testbox, NULL); // THIS LINE DOESN'T WORK SDL_BlitSurface(testbox, NULL, screen, &dest); // Paste in new location