【发布时间】:2012-04-21 10:37:29
【问题描述】:
为了简单起见,我想为我目前正在进行的项目创建自己的函数。不幸的是,它一直在关闭经过错误检查后,我发现这是它无法从中加载任何内容的错误,这是功能:
//SDL
void IMG_HANDLER::loadImage(const char * file, SDL_Surface *imgSRC)
{
imgSRC = SDL_LoadBMP(file);
if (imgSRC == NULL)
{
printf("Couldn't load IMG \n", stderr);
exit(1);
}
}
void IMG_HANDLER::SetImage(int x, int y, const char *file, SDL_Surface *dest, SDL_Surface *imgSRC)
{
loadImage(file, imgSRC);
SDL_Rect offset;
offset.x=x;
offset.y=y;
SDL_BlitSurface(imgSRC,NULL,dest, &offset);
}
//SFML
bool SpriteLoad::LoadSprite(std::string filename)
{
if (!Image.LoadFromFile(filename.c_str()))
{
printf("Can't load image file", stderr);
exit(1);
return false;
}
Sprite.SetImage(Image);
return true;
}
我对此感到很困惑,尤其是当代码完美编译时。我该如何解决这个问题?
【问题讨论】:
-
我很困惑,尤其是当代码编译完美时如果所有代码都因为它编译而工作......
-
哈哈,没错。我对这种事情还是陌生的。