Added filename paramater in custom load function
This commit is contained in:
parent
e5cef4895e
commit
1f27336b3f
|
@ -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" />
|
||||||
|
|
|
@ -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">
|
||||||
|
|
|
@ -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)
|
||||||
|
|
|
@ -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
|
||||||
|
|
Loading…
Reference in New Issue