labyrinth

changeset 8:d3f1f74067b0 tip

ops, forgot to swapbuffers on the android side
author John Tsiombikas <nuclear@member.fsf.org>
date Mon, 04 May 2015 04:56:44 +0300
parents b557812c45db
children
files .hgignore android/Makefile src/android/amain.c src/game.c
diffstat 4 files changed, 14 insertions(+), 5 deletions(-) [+]
line diff
     1.1 --- a/.hgignore	Mon May 04 02:46:35 2015 +0300
     1.2 +++ b/.hgignore	Mon May 04 04:56:44 2015 +0300
     1.3 @@ -9,3 +9,4 @@
     1.4  \.properties$
     1.5  \.apk$
     1.6  ^android/proguard-project\.txt
     1.7 +\.xml$
     2.1 --- a/android/Makefile	Mon May 04 02:46:35 2015 +0300
     2.2 +++ b/android/Makefile	Mon May 04 04:56:44 2015 +0300
     2.3 @@ -25,11 +25,11 @@
     2.4  
     2.5  android_usr = $(NDK)/platforms/$(android_platform)/arch-arm/usr
     2.6  android_inc = -I$(android_usr)/include -I$(native_app_glue_dir)
     2.7 -android_libs = -llog -landroid -lEGL -lGLESv1_CM -lm
     2.8 +android_libs = -llog -landroid -lEGL -lGLESv1_CM
     2.9  
    2.10 -CFLAGS = -std=c99 -Wall -g -DAPP_NAME=\"$(name)\" \
    2.11 +CFLAGS = -std=c99 -Wall -g -DAPP_NAME=\"$(name)\" -march=armv7-a -mfloat-abi=softfp \
    2.12  		 $(android_inc) -I$(root)/src/android -I$(root)/src/gles $(incpaths)
    2.13 -LDFLAGS = -Wl,--fix-cortex-a8 -Wl,-z,defs $(android_libs) $(libpaths)
    2.14 +LDFLAGS = -Wl,--fix-cortex-a8 -Wl,-z,defs $(android_libs) $(libpaths) -lm
    2.15  
    2.16  .PHONY: debug
    2.17  debug: $(apk-debug)
    2.18 @@ -51,7 +51,7 @@
    2.19  	$(CC) -o $@ -shared $(obj) $(LDFLAGS)
    2.20  
    2.21  ant_files = *.xml *.properties proguard-project.txt
    2.22 -ant_dirs = bin libs res
    2.23 +ant_dirs = bin libs res obj src
    2.24  
    2.25  .PHONY: clean
    2.26  clean:
     3.1 --- a/src/android/amain.c	Mon May 04 02:46:35 2015 +0300
     3.2 +++ b/src/android/amain.c	Mon May 04 04:56:44 2015 +0300
     3.3 @@ -19,6 +19,7 @@
     3.4  
     3.5  static struct android_app *app;
     3.6  static int win_width, win_height;
     3.7 +static int init_done;
     3.8  
     3.9  void android_main(struct android_app *app_ptr)
    3.10  {
    3.11 @@ -44,7 +45,10 @@
    3.12  			return;
    3.13  		}
    3.14  
    3.15 -		game_display(get_time_msec());
    3.16 +		if(init_done) {
    3.17 +			game_display(get_time_msec());
    3.18 +			eglSwapBuffers(dpy, surf);
    3.19 +		}
    3.20  	}
    3.21  }
    3.22  
    3.23 @@ -71,10 +75,12 @@
    3.24  		if(game_init() == -1) {
    3.25  			exit(1);	/* initialization failed, quit */
    3.26  		}
    3.27 +		init_done = 1;
    3.28  		break;
    3.29  
    3.30  	case APP_CMD_TERM_WINDOW:
    3.31  		/* cleanup */
    3.32 +		init_done = 0;
    3.33  		game_shutdown();
    3.34  		destroy_gl();
    3.35  		break;
     4.1 --- a/src/game.c	Mon May 04 02:46:35 2015 +0300
     4.2 +++ b/src/game.c	Mon May 04 04:56:44 2015 +0300
     4.3 @@ -75,6 +75,8 @@
     4.4  	}
     4.5  
     4.6  	player_init(&player, &level);
     4.7 +
     4.8 +	glClearColor(1, 0, 0, 1);
     4.9  	return 0;
    4.10  }
    4.11