Game Development Reference
In-Depth Information
How it works…
We provide a snippet that downloads a response from the Flickr echo service and handles the
task completion on the main thread:
volatile bool g_ShouldExit = false;
class TestCallback: public DownloadCompleteCallback
{
public:
TestCallback() {}
Print the result to the console window:
virtual void Invoke()
{
printf("Download complete\n");
printf("%s\n", (unsigned char*)FResult->GetData());
g_ShouldExit = true;
}
};
int main()
{
Curl_Load();
iAsyncQueue* Events = new iAsyncQueue();
Downloader* d = new Downloader();
d->FEventQueue = Events;
d->DownloadURL(
"http://api.flickr.com/services/rest/?method=flickr.test.echo&name
=value", 1, new TestCallback()
);
Wait for incoming events:
while (!g_ShouldExit)
{
Events->DemultiplexEvents();
}
}
 
Search WWH ::




Custom Search