Hello, I am working on a game and I have a 16x16 image that I want to make 64x64, is there a way to do this in code that does not use anything but c++ and the SDL library(no extensions)? I don't want to use OpenGL because I am still learning and I do not want to over complicate things with openGL. Thanks.
Crossbones+ - Reputation: 2023
Posted 09 March 2013 - 09:24 PM
You probably want to look into using the SDL_SoftStretch function. If you have a source 16x16 SDL_Surface* called (for example) image_16square and a destination 64x64 SDL_Surface* called (for example) image_64square you would call it like this:
SDL_SoftStretch(image_16square, NULL, image_64square, NULL);
Untested. This uses SDL 2.0. If you're using SDL 1.2 you should specify. Basically you'd lock both the 16x16 source surface and the 64x64 destination surface. Then you'd go through every pixel in the 16x16 surface and set the equivalent 4 pixels in the destination surface to the same value as that pixel.
Crossbones+ - Reputation: 2978
Posted 11 March 2013 - 03:17 PM
If you are doing scaling, or rotating, I would suggest not do anything in SDL as it is all done in software, and will slow down your PC terribly (at least using the released SDL 1.2). I would suggest looking at SFML as it does all scaling and rotating natively for you in HW.
In the long run, you'll be happy you switched IMO (not just for graphics, but for the other interfaces it provides).
---(Old Blog, still has good info): 2dGameMaking
"No one ever posts on that message board; it's too crowded." - Yoga Berra (sorta)