Created
October 17, 2014 16:03
-
-
Save pixelnerve/9162bf1964c1b8a719e0 to your computer and use it in GitHub Desktop.
emscripten test app
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <string> | |
#include <iostream> | |
#include <emscripten/emscripten.h> | |
using namespace std; | |
void onload_cb( unsigned a2, void* userData, void* data, unsigned size ) | |
{ | |
int sss = size; | |
cout << "++++ onload: " << "size: " << sss << endl; | |
} | |
void onerror_cb( unsigned a2, void* userData, int status, const char* message ) | |
{ | |
cout << "++++ onerror: " << status << " - " << message << endl; | |
} | |
void onprogress_cb( unsigned a2, void* userData, int loaded, int total ) | |
{ | |
cout << "++++ onprogress: " << ((loaded/(float)total)*100.0f) << endl; | |
} | |
void display_cb() | |
{ | |
} | |
int main( int argc, char** argv ) | |
{ | |
string url = "http://newhomesspecialists.com/wp-content/uploads/2013/08/Bathroom-Floor-Tile-Texture-2.jpg"; | |
emscripten_async_wget2_data( url.c_str(), "GET", "", NULL, true, &onload_cb, &onerror_cb, &onprogress_cb ); | |
emscripten_set_main_loop( &display_cb, 0, 1 ); | |
cout << "after mainloop\n"; | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment