添加资产管理,暂时只有加载文件到内存
This commit is contained in:
parent
4ca69c06f5
commit
214f1b8abc
24
example/Vulkan/AssetsManage.cpp
Normal file
24
example/Vulkan/AssetsManage.cpp
Normal file
@ -0,0 +1,24 @@
|
||||
#include<fstream>
|
||||
#ifndef WIN32
|
||||
#include<unistd.h>
|
||||
#endif//
|
||||
|
||||
char *LoadFileToMemory(const char *filename,unsigned __int32 &file_length)
|
||||
{
|
||||
std::ifstream fs;
|
||||
|
||||
fs.open(filename,std::ios_base::binary);
|
||||
|
||||
if(!fs.is_open())
|
||||
return(nullptr);
|
||||
|
||||
fs.seekg(0,std::ios_base::end);
|
||||
file_length=fs.tellg();
|
||||
char *data=new char[file_length];
|
||||
|
||||
fs.seekg(0,std::ios_base::beg);
|
||||
fs.read(data,file_length);
|
||||
|
||||
fs.close();
|
||||
return data;
|
||||
}
|
6
example/Vulkan/AssetsManage.h
Normal file
6
example/Vulkan/AssetsManage.h
Normal file
@ -0,0 +1,6 @@
|
||||
#ifndef HGL_ASSETS_MANAGE_INCLUDE
|
||||
#define HGL_ASSETS_MANAGE_INCLUDE
|
||||
|
||||
char *LoadFileToMemory(const char *filename,unsigned __int32 &file_length);
|
||||
|
||||
#endif//HGL_ASSETS_MANAGE_INCLUDE
|
Loading…
x
Reference in New Issue
Block a user