1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
|
SDL_Surface *temp;
temp = SDL_LoadBMP("Sprites/sprite.bmp")
if (temp == NULL) {
printf("Unable to load bitmap: %s\n", SDL_GetError());
exit(1);
}
SDL_SetColorKey( temp, SDL_SRCCOLORKEY | SDL_RLEACCEL,
SDL_MapRGB( temp->format, 255, 0, 255) );
image = SDL_DisplayFormat(temp);
SDL_FreeSurface(temp);
SDL_UnlockSurface( getSurface() );
SDL_UnlockSurface( image );
//Code to properly interpolate "GL Coordinates" to Pixel coordinates
//Assigns values into drawX and drawY
SDL_Rect rect = {drawX,drawY, 64, 64};
int worked = SDL_BlitSurface(image, NULL, getSurface(), &rect);
//printing worked displays '0', which is a success
SDL_UpdateRects( getSurface(), 1, &rect );
|