FreeRDP
Loading...
Searching...
No Matches
sdl3_resource_manager.cpp
1
18#include "sdl3_resource_manager.hpp"
19#include <iostream>
20#if __has_include(<filesystem>)
21#include <filesystem>
22namespace fs = std::filesystem;
23#elif __has_include(<experimental/filesystem>)
24#include <experimental/filesystem>
25namespace fs = std::experimental::filesystem;
26#else
27#error Could not find system header "<filesystem>" or "<experimental/filesystem>"
28#endif
29
30SDL_IOStream* SDL3ResourceManager::get(const std::string& type, const std::string& id)
31{
32 if (useCompiledResources())
33 {
34 auto d = data(type, id);
35 if (!d)
36 return nullptr;
37
38 return SDL_IOFromConstMem(d->data(), d->size());
39 }
40
41 auto name = filename(type, id);
42 return SDL_IOFromFile(name.c_str(), "rb");
43}
static SDL_IOStream * get(const std::string &type, const std::string &id)