add load image from url

This commit is contained in:
2019-09-26 14:53:44 +02:00
parent 0a8c3aeaf2
commit e406f7964c
6 changed files with 152 additions and 4 deletions

View File

@@ -13,13 +13,23 @@ public:
static std::string absolute(const std::string& path);
static bool is_asset(const std::string& path);
static bool create_dir(const std::string& path);
bool m_stop_async = false;
std::function<bool(float)> on_progress;
std::future<bool> remote_future;
std::string m_current_path;
std::string m_current_url;
FILE* m_fp = nullptr;
int m_len = 0;
uint8_t* m_data = nullptr;
bool open(const char* path);
bool open_url(const std::string& url, std::function<bool(float)> progress = nullptr);
std::future<bool>& open_url_async(const std::string& url, std::function<bool(float)> progress = nullptr,
std::function<void(bool)> complete = nullptr);
uint8_t* read_all();
void close();
~Asset() { close(); }
void close_remote();
~Asset();
};