Code: Select all
bool CPlayer::loadSprites(video::IVideoDriver* driver, IrrlichtDevice* device)
{
if(device == NULL)
{
return false;
}
if(driver == NULL)
{
return false;
}
io::IFileSystem* filesystem = device->getFileSystem();
if(filesystem == NULL)
{
return false;
}
if(!filesystem->changeWorkingDirectoryTo("PLAYER"))
{
return false;
}
io::IFileList* filelist = filesystem->createFileList();
if(filelist == NULL)
{
return false;
}
if(filelist->getFileCount() == 0)
{
return false;
}
else
{
for(int i = 2; i < filelist->getFileCount() - 2; i++)
{
c8 filename[MAX_PATH] = "";
strcpy(filename, filelist->getFileName(i));
if(strstr(filename, "up"))
{
c8 name[12] = "";
strcpy(name, filelist->getFileName(i));
sprite_sheet[0]->setname(name);
sprite_sheet[0]->setSprite(driver->getTexture(sprite_sheet[0]->getname()));
}
else if(strstr(filename, "down"))
{
c8 name[12] = "";
strcpy(name, filelist->getFileName(i));
sprite_sheet[1]->setname(name);
sprite_sheet[1]->setSprite(driver->getTexture(sprite_sheet[1]->getname()));
}
else if(strstr(filename, "left"))
{
c8 name[12] = "";
strcpy(name, filelist->getFileName(i));
sprite_sheet[2]->setname(name);
sprite_sheet[2]->setSprite(driver->getTexture(sprite_sheet[2]->getname()));
}
else if(strstr(filename, "right"))
{
c8 name[12] = "";
strcpy(name, filelist->getFileName(i));
sprite_sheet[3]->setname(name);
sprite_sheet[3]->setSprite(driver->getTexture(sprite_sheet[3]->getname()));
}
}
filelist->drop();
return true;
}
return false;
}
The problem is at this line:
Code: Select all
io::IFileList* filelist = filesystem->createFileList();
if(filelist == NULL)
{
return false;
}
I am using DevCpp and irrlicht 1.2. The only other lib file besides the irrlicht files is libwinmm.a, if thats any help. If any other information is required please let me know.
I am very confused and frustrated so any help would be greatly appreciated.