#include <stdlib.h>
#include <EGL/egl.h>
#include <GLES2/gl2.h>
-
#include "demo.h"
#include "android_native_app_glue.h"
+#include "logger.h"
static void handle_command(struct android_app *app, int32_t cmd);
static int handle_input(struct android_app *app, AInputEvent *ev);
static int init_gl(void);
static void destroy_gl(void);
-static struct android_app *app;
+struct android_app *app;
+
static EGLDisplay dpy;
static EGLSurface surf;
static EGLContext ctx;
-static int running;
+static int init_done, paused;
static int width, height;
app->onAppCmd = handle_command;
app->onInputEvent = handle_input;
+ start_logger();
+
for(;;) {
int num_events;
struct android_poll_source *pollsrc;
if(app->destroyRequested) {
return;
}
- if(running) {
+ if(init_done && !paused) {
demo_display();
eglSwapBuffers(dpy, surf);
}
switch(cmd) {
case APP_CMD_PAUSE:
- running = 0; /* TODO: handle timers */
+ paused = 1; /* TODO: handle timers */
break;
case APP_CMD_RESUME:
- running = 1;
+ paused = 0;
break;
case APP_CMD_INIT_WINDOW:
exit(1);
}
demo_reshape(width, height);
- running = 1;
+ init_done = 1;
break;
case APP_CMD_TERM_WINDOW:
- running = 0;
+ init_done = 0;
demo_cleanup();
destroy_gl();
break;