mirror of
https://github.com/Kiritow/MiniEngine.git
synced 2024-03-22 13:11:22 +08:00
Add Support for SDL_RWops
This commit is contained in:
parent
af18ae23da
commit
01735059fc
|
@ -129,6 +129,27 @@ namespace MiniEngine
|
||||||
return str.c_str();
|
return str.c_str();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
RWOP::RWOP(FILE* fp,bool autoclose)
|
||||||
|
{
|
||||||
|
SDL_bool b=autoclose?SDL_TRUE:SDL_FALSE;
|
||||||
|
op.reset(SDL_RWFromFP(fp,b),[](SDL_RWops* p){SDL_RWclose(p);});
|
||||||
|
}
|
||||||
|
|
||||||
|
RWOP::RWOP(const std::string& filename,const std::string& openmode)
|
||||||
|
{
|
||||||
|
op.reset(SDL_RWFromFile(filename.c_str(),openmode.c_str()),[](SDL_RWops* p){SDL_RWclose(p);});
|
||||||
|
}
|
||||||
|
|
||||||
|
RWOP::RWOP(const void* mem,int size)
|
||||||
|
{
|
||||||
|
op.reset(SDL_RWFromConstMem(mem,size),[](SDL_RWops* p){SDL_RWclose(p);});
|
||||||
|
}
|
||||||
|
|
||||||
|
RWOP::RWOP(void* mem,int size)
|
||||||
|
{
|
||||||
|
op.reset(SDL_RWFromMem(mem,size),[](SDL_RWops* p){SDL_RWclose(p);});
|
||||||
|
}
|
||||||
|
|
||||||
Texture::Texture()
|
Texture::Texture()
|
||||||
{
|
{
|
||||||
updateInfo();
|
updateInfo();
|
||||||
|
|
14
MiniEngine.h
14
MiniEngine.h
|
@ -72,6 +72,20 @@ namespace MiniEngine
|
||||||
std::string str;
|
std::string str;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class RWOP
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
RWOP(FILE* fp,bool autoclose);
|
||||||
|
RWOP(const std::string& filename,const std::string& openmode);
|
||||||
|
RWOP(const void* mem,int size);
|
||||||
|
RWOP(void* mem,int size);
|
||||||
|
RWOP()=default;
|
||||||
|
~RWOP()=default;
|
||||||
|
private:
|
||||||
|
std::shared_ptr<SDL_RWops> op;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
enum class BlendMode
|
enum class BlendMode
|
||||||
{
|
{
|
||||||
None = SDL_BLENDMODE_NONE,
|
None = SDL_BLENDMODE_NONE,
|
||||||
|
|
Loading…
Reference in New Issue
Block a user