istereo2

diff src/android/amain.c @ 24:9d53a4938ce8

port to android mostly complete, ads not done, and needs some polishing
author John Tsiombikas <nuclear@member.fsf.org>
date Sun, 04 Oct 2015 08:15:24 +0300
parents 7d795dade0bc
children f0da8b2b61ec
line diff
     1.1 --- a/src/android/amain.c	Sat Oct 03 06:10:30 2015 +0300
     1.2 +++ b/src/android/amain.c	Sun Oct 04 08:15:24 2015 +0300
     1.3 @@ -2,8 +2,8 @@
     1.4  #include <stdlib.h>
     1.5  #include <assert.h>
     1.6  #include <EGL/egl.h>
     1.7 -#include <jni.h>
     1.8  #include "android_native_app_glue.h"
     1.9 +#include <android/window.h>
    1.10  #include <android/sensor.h>
    1.11  #include "logger.h"
    1.12  #include "istereo.h"
    1.13 @@ -33,6 +33,8 @@
    1.14  	app->onAppCmd = handle_command;
    1.15  	app->onInputEvent = handle_input;
    1.16  
    1.17 +	//ANativeActivity_setWindowFlags(app->activity, AWINDOW_FLAG_FULLSCREEN, 0);
    1.18 +
    1.19  	start_logger();
    1.20  
    1.21  	for(;;) {
    1.22 @@ -81,6 +83,7 @@
    1.23  		break;
    1.24  
    1.25  	case APP_CMD_INIT_WINDOW:
    1.26 +		printf("APP_CMD_INIT_WINDOW\n");
    1.27  		if(init_gl() == -1) {
    1.28  			exit(1);
    1.29  		}
    1.30 @@ -88,21 +91,25 @@
    1.31  		if(init() == -1) {
    1.32  			exit(1);	/* initialization failed, quit */
    1.33  		}
    1.34 +		reshape(width, height);
    1.35  		init_done = 1;
    1.36  		break;
    1.37  
    1.38  	case APP_CMD_TERM_WINDOW:
    1.39  		/* cleanup */
    1.40 +		printf("APP_CMD_TERM_WINDOW\n");
    1.41  		init_done = 0;
    1.42  		cleanup();
    1.43  		destroy_gl();
    1.44  		break;
    1.45  
    1.46  	case APP_CMD_GAINED_FOCUS:
    1.47 +		printf("APP_CMD_GAINED_FOCUS\n");
    1.48  		/* app focused */
    1.49  		break;
    1.50  
    1.51  	case APP_CMD_LOST_FOCUS:
    1.52 +		printf("APP_CMD_LOST_FOCUS\n");
    1.53  		/* app lost focus */
    1.54  		break;
    1.55  
    1.56 @@ -112,6 +119,7 @@
    1.57  			int nx = ANativeWindow_getWidth(app->window);
    1.58  			int ny = ANativeWindow_getHeight(app->window);
    1.59  			if(nx != width || ny != height) {
    1.60 +				printf("reshape(%d, %d)\n", nx, ny);
    1.61  				reshape(nx, ny);
    1.62  				width = nx;
    1.63  				height = ny;
    1.64 @@ -250,6 +258,7 @@
    1.65  
    1.66  	eglQuerySurface(dpy, surf, EGL_WIDTH, &width);
    1.67  	eglQuerySurface(dpy, surf, EGL_HEIGHT, &height);
    1.68 +	printf("initial reshape call: %dx%d\n", width, height);
    1.69  	reshape(width, height);
    1.70  
    1.71  	return 0;