fplutil
An open source project by
FPL.
|
Go to the source code of this file.
Functions | |
int | main (int argc, char **argv) |
This should be implemented by the application including this header. | |
void | ProcessAndroidEvents (int maxWait) |
Header for libfplutil_main.
libfplutil_main makes it easy to build traditional C/C++ applications for Android that use an int main()
entry point.
Linking this library adds functionality to call a standard C main() from Android's NativeActivity NDK entry point, android_main(). This helps you by by making it very easy to resuse existing programs with a C main() entry point.
For example, this code:
will launch, "do stuff", and exit the NativeActivity on return from main(). The android_main() is implemented inside this library for you.
If "do stuff" requires nontrivial amounts of time, such as entering a main loop and looping forever, then it is advisable to add a call the ProcessAndroidEvents() function below periodically, which will minimally service events on the native activity looper.
For more information see ndk/sources/android/native_app_glue
.
void ProcessAndroidEvents | ( | int | maxWait | ) |
Process android events on the main NativeActivity thread ALooper.
This waits for and processes any pending events from the Android SDK being passed into the NDK. The call will block up to maxWait milliseconds for pending Android events.
maxWait | 0 returns immediately, -1 blocks indefinitely until an event arrives. |