clean-libs:
$(MAKE) -C libs clean
+.PHONY: android
+android:
+ $(MAKE) -f Makefile.android
+
+.PHONY: android-clean
+android-clean:
+ $(MAKE) -f Makefile.android clean
+
+.PHONY: android-libs
+android-libs:
+ $(MAKE) -f Makefile.android libs
.PHONY: cross
cross:
CC = $(TC)clang
CFLAGS = $(CCSYSROOT) $(ISYS) $(warn) $(dbg) $(opt) $(def) $(incdir) -fPIC -fcommon -MMD
-LDFLAGS = $(LDSYSROOT) $(libdir) -landroid -llog -lEGL -lGLESv2 -limago
+LDFLAGS = $(LDSYSROOT) $(libdir) -lm -landroid -llog -lEGL -lGLESv2 -limago
$(name).apk: $(name).aligned.apk keystore.jks
apksigner sign --ks keystore.jks --ks-key-alias androidkey --ks-pass pass:android --key-pass pass:android --out $@ $<
mkdir -p apkbuild/assets
cp -r data apkbuild/assets
cp -r sdr apkbuild/assets
- aapt package -f -v -F $@ -I $(PLATFORM_JAR) -M AndroidManifest.xml apkbuild
+ aapt package -f -F $@ -I $(PLATFORM_JAR) -M AndroidManifest.xml apkbuild
$(lib_so): $(obj) Makefile.android
- $(CC) -o $@ -shared $(obj) $(LDFLAGS)
+ $(CC) -o $@ -shared -Wl,-soname,$(lib_so) $(obj) $(LDFLAGS)
-include $(dep)
.PHONY: stop
stop:
adb shell am force-stop $(pkg)
+
+.PHONY: logcat
+logcat:
+ adb logcat $(name):V AndroidRuntime:V DEBUG:V '*:S'
--- /dev/null
+#!/bin/sh
+
+make -f Makefile.android install && \
+ make -f Makefile.android run
#include "assfile.h"
#include "android_native_app_glue.h"
-struct android_app *app; /* defined in android/amain.c */
+extern struct android_app *app; /* defined in android/main.c */
static int putback_buf = -1;
#include "logger.h"
#ifndef APP_NAME
-#define APP_NAME "xmas_inferno"
+#define APP_NAME "andemo"
#endif
static void *thread_func(void *arg);
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;
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;
+#include <stdio.h>
#include "demo.h"
#include "opengl.h"
#include "sanegl.h"