add webgl support

This commit is contained in:
2019-10-05 21:08:40 +02:00
parent a1c0dcb007
commit f2a73a905d
19 changed files with 370 additions and 11 deletions

View File

@@ -145,6 +145,8 @@ bool Asset::create_dir(const std::string& path)
return android_create_dir(path);
#elif __IOS__ || __OSX__
return apple_create_dir(path);
else
return false;
#endif
}
@@ -155,6 +157,7 @@ static size_t curl_data_handler_asset(void* contents, size_t size, size_t nmemb,
return size * nmemb;
}
#if WITH_CURL
static int progress_callback_asset_download(void* clientp, curl_off_t dltotal,
curl_off_t dlnow, curl_off_t ultotal, curl_off_t ulnow)
{
@@ -168,9 +171,11 @@ static int progress_callback_asset_download(void* clientp, curl_off_t dltotal,
bool cont = ass->on_progress(p);
return cont ? 0 : 1;
}
#endif //CURL
bool Asset::open_url(const std::string& url, std::function<bool(float)> progress /*= nullptr*/)
{
#if WITH_CURL
CURL* curl = curl_easy_init();
if (curl)
{
@@ -204,6 +209,7 @@ bool Asset::open_url(const std::string& url, std::function<bool(float)> progress
return true;
}
}
#endif // CURL
return false;
}