
class BMXIImageLoader : public IImageLoader
{
public:

	BMXBinder binder;

	bool (*BMXIImageLoader_isALoadableFileExtension)(s32 binding, const c8* fileName);
	bool (*BMXIImageLoader_isALoadableFileFormat)(s32 binding,irr::io::IReadFile* file);
	IImage* (*BMXIImageLoader_loadImage)(s32 binding,irr::io::IReadFile* file);

	BMXBinder* getBinder()
	{
		return &binder;
	}

	BMXIImageLoader() : IImageLoader()
	{
		BMXIImageLoader_isALoadableFileExtension=0;
		BMXIImageLoader_isALoadableFileFormat=0;
		BMXIImageLoader_loadImage=0;
	}

	bool isALoadableFileExtension(const io::path& filename) const
	{
		if (BMXIImageLoader_isALoadableFileExtension)
			return BMXIImageLoader_isALoadableFileExtension(binder.binding, filename.c_str());
		else return false;
	}

	bool isALoadableFileFormat(irr::io::IReadFile* file) const
	{
		if (BMXIImageLoader_isALoadableFileFormat)
			return BMXIImageLoader_isALoadableFileFormat(binder.binding,file);
		else return false;
	}
 
	IImage* loadImage(irr::io::IReadFile* file) const
	{
		if (BMXIImageLoader_loadImage)
			return BMXIImageLoader_loadImage(binder.binding,file);
		else return 0;
	}
};

extern "C"
{
	BMXBinder* IrrVideo_BMXIImageLoader_getBinder(BMXIImageLoader* loader)
	{
		if (loader)
			return loader->getBinder();
		else return 0;
	}
	
	BMXIImageLoader* IrrVideo_BMXIImageLoader_new()
	{
		return new BMXIImageLoader();
	}
	
	void IrrVideo_BMXIImageLoader_bindIsALoadableFileExtension(BMXIImageLoader* loader,bool (*bind_isALoadableFileExtension)(s32 binding, const c8* fileName))
	{
		if (loader)
			loader->BMXIImageLoader_isALoadableFileExtension=bind_isALoadableFileExtension;
	}
	
	void IrrVideo_BMXIImageLoader_bindIsALoadableFileFormat(BMXIImageLoader* loader,bool (*bind_isALoadableFileFormat)(s32 binding,irr::io::IReadFile* file))
	{
		if (loader)
			loader->BMXIImageLoader_isALoadableFileFormat=bind_isALoadableFileFormat;
	}

	void IrrVideo_BMXIImageLoader_bindLoadImage(BMXIImageLoader* loader,IImage* (*bind_loadImage)(s32 binding,irr::io::IReadFile* file))
	{
		if (loader)
			loader->BMXIImageLoader_loadImage=bind_loadImage;
	}	
}

