making a surface = to part of larger surface

Started by
4 comments, last by graveyard filla 19 years, 4 months ago
is there any good way to "cut" a big surface up by making surfaces = to smaller parts of it thanks [smile]
____________________________"This just in, 9 out of 10 americans agree that 1 out of 10 americans will disagree with the other 9"- Colin Mochrie
Advertisement
Write your own function? It should just be as simple as creating x*y new surfaces and then blitting from the larger ones to the smaller one.
HxRender | Cornerstone SDL TutorialsCurrently picking on: Hedos, Programmer One
[source lang = "cpp"]//Setup SDL and other stuff. . .SDL_Surface * BigSurface = SDL_LoadBMP("BIGIMAGE.bmp");SDL_Rect SmallImage;SmallImage.x = 0;SmallImage.y = 0;SmallImage.w = 100;SmallImage.h = 100;SDL_Surface * SmallerImage = SDL_CreateRGBSurface(0, SmallImage.w, SmallImage.h, 32, 0 0 0 0); // More info look in the docsSDL_BlitSurface(BigSurface, &SmallImage, SmallerImage, NULL);
well the first method wont work because i dont want to blit them i want to save them to a file and the second one wont work because it only makes a solid 1 color surface thanks for the replys though
____________________________"This just in, 9 out of 10 americans agree that 1 out of 10 americans will disagree with the other 9"- Colin Mochrie
Uhm, no my method works, i use it all the time for sprites. . .
Quote:Original post by raptorstrike
well the first method wont work because i dont want to blit them i want to save them to a file and the second one wont work because it only makes a solid 1 color surface thanks for the replys though


you can save an SDL Surface to a file using SDL_SaveBMP().
FTA, my 2D futuristic action MMORPG

This topic is closed to new replies.

Advertisement