Game Development Reference
In-Depth Information
5.
Further compilation requires a usual set of Android.mk/Application.mk iles,
which is also available in the accompanying materials.
How it works…
A simplistic usage example looks like the following:
CURL* Curl = curl_easy_init();
curl_easy_setopt( Curl, CURLOPT_URL, “http://www.google.com” );
curl_easy_setopt( Curl, CURLOPT_FOLLOWLOCATION, 1 );
curl_easy_setopt( Curl, CURLOPT_FAILONERROR, true );
curl_easy_setopt( Curl, CURLOPT_WRITEFUNCTION, &MemoryCallback );
curl_easy_setopt( Curl, CURLOPT_WRITEDATA, 0 );
curl_easy_perform( Curl );
curl_easy_cleanup( Curl );
Here MemoryCallback() is a function that handles the received data. A minimalistic unsafe
implementation to dump a network response to the terminal can be as follows:
size_t MemoryCallback( void* P, size_t Size, size_t Num, void* )
{
printf( (unsigned char*)P) );
}
The retrieved data will be printed on the screen in the Windows application. The same code
will work like a dummy in Android, without producing any visible side effects.
There's more…
In order to work with SSL-encrypted connections, we need to tell libcurl where our system
certiicates are located. This can be done with CURL_CA_BUNDLE deined in the beginning of
the curl_config.h ile:
#define CURL_CA_BUNDLE “/etc/ssl/certs/ca-certificates.crt”
See also
F Chapter 3 , Networking
Compiling the OpenAL library
OpenAL is a cross-platform audio library used in many gaming engines. Here are some notes
on how to build it for Android.
 
Search WWH ::




Custom Search