add load image from url
This commit is contained in:
12
src/asset.h
12
src/asset.h
@@ -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();
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user