(Android) Not sure if we have to do this 'event loop' in gfx_ctx_check_window

- make it sample one frame of events and that is it - also comment out
accelerometer stuff for now
This commit is contained in:
twinaphex 2012-10-21 16:37:15 +02:00
parent 81b2cce5ac
commit 647fd0abf0
3 changed files with 42 additions and 22 deletions

View File

@ -1,8 +1,21 @@
RARCH_VERSION = "0.9.7"
LOCAL_PATH := $(call my-dir)
PERF_TEST := 1
include $(CLEAR_VARS)
ifeq ($(TARGET_ARCH),arm)
LOCAL_CFLAGS += -DANDROID_ARM -marm
endif
ifeq ($(TARGET_ARCH),x86)
LOCAL_CFLAGS += -DANDROID_X86
endif
ifeq ($(TARGET_ARCH),mips)
LOCAL_CFLAGS += -DANDROID_MIPS -D__mips__ -D__MIPSEL__
endif
LOCAL_MODULE := retroarch-activity
HAVE_OPENSL := 1
@ -44,8 +57,12 @@ LOCAL_SRC_FILES = $(RARCH_PATH)/retroarch.c \
$(RARCH_PATH)/thread.c \
main.c
ifeq ($(PERF_TEST), 1)
LOCAL_SRC_FILES += $(RARCH_PATH)/benchmark.c
LOCAL_CFLAGS += -DPERF_TEST
endif
LOCAL_CFLAGS = -marm -DANDROID -DHAVE_DYNAMIC -DHAVE_OPENGL -DHAVE_OPENGLES -DHAVE_OPENGLES2 -DGLSL_DEBUG -DHAVE_GLSL -DHAVE_ZLIB -DINLINE=inline -DLSB_FIRST -D__LIBRETRO__ -DHAVE_CONFIGFILE=1 -DPACKAGE_VERSION=\"$(RARCH_VERSION)\" -std=gnu99
LOCAL_CFLAGS += -DANDROID -DHAVE_DYNAMIC -DHAVE_OPENGL -DHAVE_OPENGLES -DHAVE_OPENGLES2 -DGLSL_DEBUG -DHAVE_GLSL -DHAVE_ZLIB -DINLINE=inline -DLSB_FIRST -D__LIBRETRO__ -DHAVE_CONFIGFILE=1 -DPACKAGE_VERSION=\"$(RARCH_VERSION)\" -std=gnu99
LOCAL_LDLIBS := -L$(SYSROOT)/usr/lib -landroid -lEGL -lGLESv2 -llog -ldl -lz

View File

@ -1 +1,2 @@
APP_PLATFORM := android-9
APP_ABI := armeabi armeabi-v7a

View File

@ -171,31 +171,33 @@ static void gfx_ctx_check_window(bool *quit,
// If not animating, we will block forever waiting for events.
// If animating, we loop until all events are read, then continue
// to draw the next frame of animation.
while ((ident=ALooper_pollAll(g_android.animating ? 0 : -1, NULL, &events,
(void**)&source)) >= 0)
ident=ALooper_pollAll(g_android.animating ? 0 : -1, NULL, &events,
(void**)&source);
// Process this event.
if (source != NULL)
source->process(state, source);
// If a sensor has data, process it now.
/*
if (ident == LOOPER_ID_USER && g_android.accelerometerSensor != NULL)
{
// Process this event.
if (source != NULL)
source->process(state, source);
// If a sensor has data, process it now.
if (ident == LOOPER_ID_USER && g_android.accelerometerSensor != NULL)
ASensorEvent event;
while (ASensorEventQueue_getEvents(g_android.sensorEventQueue, &event, 1) > 0)
{
ASensorEvent event;
while (ASensorEventQueue_getEvents(g_android.sensorEventQueue, &event, 1) > 0)
{
//RARCH_LOG("accelerometer: x=%f y=%f z=%f.\n", event.acceleration.x, event.acceleration.y, event.acceleration.z);
}
RARCH_LOG("accelerometer: x=%f y=%f z=%f.\n", event.acceleration.x,
event.acceleration.y, event.acceleration.z);
}
}
*/
// Check if we are exiting.
if (state->destroyRequested != 0)
{
gl->quitting = true;
*quit = true;
gfx_ctx_destroy();
return;
}
// Check if we are exiting.
if (state->destroyRequested != 0)
{
gl->quitting = true;
*quit = true;
gfx_ctx_destroy();
return;
}
if (g_android.animating)