Added filename paramater in custom load function
This commit is contained in:
parent
e5cef4895e
commit
1f27336b3f
|
@ -148,7 +148,6 @@
|
|||
<ItemGroup>
|
||||
<ClCompile Include="Resource\Loaders\ByteLoader.cpp" />
|
||||
<ClCompile Include="Resource\Loaders\CustomLoader.cpp" />
|
||||
<ClCompile Include="MainTest.cpp" />
|
||||
<ClCompile Include="Resource\OResourceHandler.cpp" />
|
||||
<ClCompile Include="Resource\OResource.cpp" />
|
||||
<ClCompile Include="Utilities.cpp" />
|
||||
|
|
|
@ -33,9 +33,6 @@
|
|||
<ClCompile Include="Resource\Loaders\CustomLoader.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="MainTest.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="Utilities.h">
|
||||
|
|
|
@ -9,7 +9,7 @@ using namespace Oyster::Resource;
|
|||
|
||||
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.resourceUnloadFnc) return 0;
|
||||
|
@ -31,7 +31,7 @@ OResource* OResource::CustomReloader()
|
|||
{
|
||||
CustomUnloader();
|
||||
|
||||
const CustomData &data = this->customData->loadingFunction();
|
||||
const CustomData &data = this->customData->loadingFunction(this->resourceFilename.c_str());
|
||||
this->resourceData = (OHRESOURCE)data.loadedData;
|
||||
|
||||
if(data.resourceUnloadFnc)
|
||||
|
|
|
@ -13,8 +13,8 @@ namespace Oyster
|
|||
struct CustomData;
|
||||
/** A Resource handle representing various resources */
|
||||
typedef unsigned long OHRESOURCE;
|
||||
typedef void(*CustomUnloadFunction)(void*);
|
||||
typedef const CustomData&(*CustomLoadFunction)();
|
||||
typedef void(*CustomUnloadFunction)(void* loadedData);
|
||||
typedef const CustomData&(*CustomLoadFunction)(const wchar_t filename[]);
|
||||
|
||||
/** An enum class representing all avalible resources that is supported. */
|
||||
enum ResourceType
|
||||
|
|
Loading…
Reference in New Issue