Conseguí hacer un void para crear un rectángulo pero ¿como le meto una imagen?
Edito: Pongo mi código entero.
#include <SDL/SDL.h>
void new_tile (SDL_Surface *screen, int x, int y)
{
SDL_Rect rect = {x, y, 32, 32};
Uint32 a = SDL_MapRGB(screen->format, 255, 200, 100);
SDL_FillRect(screen, &rect, a);
SDL_UpdateRect(screen, rect.x, rect.y, rect.w, rect.h);
}
int main(int argc, char *argv[])
{
SDL_Init(SDL_INIT_EVERYTHING);
SDL_Surface *buffer;
SDL_WM_SetCaption("Killforce", NULL);
bool fullscreen = false;
if (fullscreen == false)
{
buffer = SDL_SetVideoMode(800, 600, 32, SDL_SWSURFACE);
} else {
buffer = SDL_SetVideoMode(800, 600, 32, SDL_SWSURFACE | SDL_FULLSCREEN);
}
new_tile(buffer, 0, 0);
SDL_Event event;
while (event.type != SDL_QUIT)
{
SDL_PollEvent(&event);
SDL_Flip(buffer);
}
SDL_FreeSurface(buffer);
SDL_Quit();
return 0;
}