Skip to content

Instantly share code, notes, and snippets.

@coderarity
Created January 1, 2013 08:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save coderarity/4425929 to your computer and use it in GitHub Desktop.
Save coderarity/4425929 to your computer and use it in GitHub Desktop.
Awesome lack of Java on android! I am pleased.
// from http://android-developers.blogspot.com/2011/01/gingerbread-ndk-awesomeness.html
void android_main(struct android_app* state) {
// Make sure glue isn't stripped.
app_dummy();
// loop waiting for stuff to do.
while (1) {
// Read all pending events.
int ident;
int events;
struct android_poll_source* source;
// Read events and draw a frame of animation.
if ((ident = ALooper_pollAll(0, NULL, &events,
(void**)&source)) >= 0) {
// Process this event.
if (source != NULL) {
source->process(state, source);
}
}
// draw a frame of animation
bringTheAwesome();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment