Original Post
Im pretty sure i have had this problem before, and i posted here, and it got solved. Now i think im having that problem again and i have forgotten the solution. The problem is that SDL wont draw: . All the DLL's are in the right place . All the linker settings are in the right place. . The screen surface is not NULL . The image that im trying to draw's surface is not NULL . The drawing and image loading code is taken out one of my other projects that worked here is my drawing function: here is the image loading code: the image is not all pink(colour keying colour). Please can someone help me [Edited by - Lith on May 13, 2010 11:25:51 AM]
//www.lazyfoo.net
void E_CORE::DrawImg(int x, int y, SDL_Surface *source, SDL_Surface *destination, SDL_Rect* clip = NULL)
{
SDL_Rect offset;
offset.x = x;
offset.y = y;
SDL_BlitSurface(source, clip, destination, &offset);
}
//www.lazyfoo.net
SDL_Surface* E_CORE::LoadImg(string filename)
{
SDL_Surface* loadedImage = NULL;
SDL_Surface* optimizedImage = NULL;
loadedImage = IMG_Load(filename.c_str());
//check for errors
if(loadedImage != NULL)
{
//if there were no errors
optimizedImage = SDL_DisplayFormat(loadedImage);
SDL_FreeSurface(loadedImage);
if(optimizedImage != NULL)
{
//set the colour key
Uint32 colorkey = SDL_MapRGB(optimizedImage->format, 255, 0, 255);
SDL_SetColorKey(optimizedImage, SDL_SRCCOLORKEY, colorkey);
}
}
if(optimizedImage == NULL)
{
cout << "Failed to load " << filename << endl;
}
else
{
cout << "Loaded " << filename << endl;
}
return optimizedImage;
}