Added filename paramater in custom load function

This commit is contained in:
dean11 2013-11-26 12:09:38 +01:00
parent e5cef4895e
commit 1f27336b3f
4 changed files with 4 additions and 8 deletions

View File

@ -148,7 +148,6 @@
<ItemGroup> <ItemGroup>
<ClCompile Include="Resource\Loaders\ByteLoader.cpp" /> <ClCompile Include="Resource\Loaders\ByteLoader.cpp" />
<ClCompile Include="Resource\Loaders\CustomLoader.cpp" /> <ClCompile Include="Resource\Loaders\CustomLoader.cpp" />
<ClCompile Include="MainTest.cpp" />
<ClCompile Include="Resource\OResourceHandler.cpp" /> <ClCompile Include="Resource\OResourceHandler.cpp" />
<ClCompile Include="Resource\OResource.cpp" /> <ClCompile Include="Resource\OResource.cpp" />
<ClCompile Include="Utilities.cpp" /> <ClCompile Include="Utilities.cpp" />

View File

@ -33,9 +33,6 @@
<ClCompile Include="Resource\Loaders\CustomLoader.cpp"> <ClCompile Include="Resource\Loaders\CustomLoader.cpp">
<Filter>Source Files</Filter> <Filter>Source Files</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="MainTest.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClInclude Include="Utilities.h"> <ClInclude Include="Utilities.h">

View File

@ -9,7 +9,7 @@ using namespace Oyster::Resource;
OResource* OResource::CustomLoader(const wchar_t filename[], CustomLoadFunction fnc) OResource* OResource::CustomLoader(const wchar_t filename[], CustomLoadFunction fnc)
{ {
const CustomData &data = fnc(); const CustomData &data = fnc(filename);
if(!data.loadedData) return 0; if(!data.loadedData) return 0;
if(!data.resourceUnloadFnc) return 0; if(!data.resourceUnloadFnc) return 0;
@ -31,7 +31,7 @@ OResource* OResource::CustomReloader()
{ {
CustomUnloader(); CustomUnloader();
const CustomData &data = this->customData->loadingFunction(); const CustomData &data = this->customData->loadingFunction(this->resourceFilename.c_str());
this->resourceData = (OHRESOURCE)data.loadedData; this->resourceData = (OHRESOURCE)data.loadedData;
if(data.resourceUnloadFnc) if(data.resourceUnloadFnc)

View File

@ -13,8 +13,8 @@ namespace Oyster
struct CustomData; struct CustomData;
/** A Resource handle representing various resources */ /** A Resource handle representing various resources */
typedef unsigned long OHRESOURCE; typedef unsigned long OHRESOURCE;
typedef void(*CustomUnloadFunction)(void*); typedef void(*CustomUnloadFunction)(void* loadedData);
typedef const CustomData&(*CustomLoadFunction)(); typedef const CustomData&(*CustomLoadFunction)(const wchar_t filename[]);
/** An enum class representing all avalible resources that is supported. */ /** An enum class representing all avalible resources that is supported. */
enum ResourceType enum ResourceType