SDL_Renderer backend and SDL_image texture loader
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
#include <unordered_map>
|
||||
#include <fstream>
|
||||
#include <sstream>
|
||||
#include "../UsefulException.hpp"
|
||||
#include "../exceptions.hpp"
|
||||
#include "../format.hpp"
|
||||
#include "Resources.hpp"
|
||||
#include "embedded_resources.h"
|
||||
@@ -19,16 +19,27 @@ MemoryStreamBuf::MemoryStreamBuf(void* _p, const std::size_t n){
|
||||
setp(p, p + n);
|
||||
}
|
||||
|
||||
class MemoryStreamRead : public std::istream {
|
||||
public:
|
||||
MemoryStreamRead(const void* p, const std::size_t n)
|
||||
: std::istream(new MemoryStreamBuf((void*)p, n))
|
||||
{}
|
||||
std::istream::pos_type MemoryStreamBuf::seekoff(
|
||||
std::istream::off_type off,
|
||||
std::ios_base::seekdir dir,
|
||||
std::ios_base::openmode which)
|
||||
{
|
||||
if (dir == std::ios_base::cur)
|
||||
gbump(off);
|
||||
else if (dir == std::ios_base::end)
|
||||
setg(eback(), egptr() + off, egptr());
|
||||
else if (dir == std::ios_base::beg)
|
||||
setg(eback(), eback() + off, egptr());
|
||||
return gptr() - eback();
|
||||
}
|
||||
|
||||
virtual ~MemoryStreamRead(){
|
||||
delete rdbuf();
|
||||
}
|
||||
};
|
||||
MemoryStreamRead::MemoryStreamRead(const void* p, const std::size_t n)
|
||||
: std::istream(new MemoryStreamBuf((void*)p, n))
|
||||
{}
|
||||
|
||||
MemoryStreamRead::~MemoryStreamRead(){
|
||||
delete rdbuf();
|
||||
}
|
||||
|
||||
static std::unordered_map<std::string, Resource>* _resourceMap = nullptr;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user