(Android) Get rid of unused width/height/animated in g_android struct

This commit is contained in:
twinaphex 2012-10-31 17:12:18 +01:00
parent 291280670d
commit cbcffbb5cf
3 changed files with 36 additions and 65 deletions

View File

@ -22,9 +22,6 @@ struct droid
bool init_quit; bool init_quit;
bool window_inited; bool window_inited;
unsigned animating;
unsigned width;
unsigned height;
struct saved_state state; struct saved_state state;
}; };

View File

@ -91,9 +91,6 @@ static void engine_handle_cmd(struct android_app* app, int32_t cmd)
ASensorEventQueue_disableSensor(g_android.sensorEventQueue, ASensorEventQueue_disableSensor(g_android.sensorEventQueue,
g_android.accelerometerSensor); g_android.accelerometerSensor);
#endif #endif
// Also stop animating.
g_android.animating = 0;
} }
break; break;
} }
@ -178,45 +175,28 @@ void android_main(struct android_app* state)
argv[argc++] = strdup(libretro_path); argv[argc++] = strdup(libretro_path);
argv[argc++] = strdup("-v"); argv[argc++] = strdup("-v");
g_android.animating = 1;
g_extern.verbose = true; g_extern.verbose = true;
while(!g_android.window_inited) while(!g_android.window_inited)
{ {
// Read all pending events. // Read all pending events.
int ident; int ident;
int events;
struct android_poll_source* source; struct android_poll_source* source;
// If not animating, we will block forever waiting for events. // Block forever waiting for events.
// If animating, we loop until all events are read, then continue while ((ident=ALooper_pollAll(0, NULL, 0, (void**)&source)) >= 0)
// to draw the next frame of animation.
while ((ident=ALooper_pollAll(g_android.animating ? 0 : -1, NULL, &events,
(void**)&source)) >= 0)
{ {
// Process this event. // Process this event.
if (source != NULL) if (source != NULL)
source->process(g_android.app, source); source->process(g_android.app, 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)
{
//RARCH_LOG("accelerometer: x=%f y=%f z=%f.\n", event.acceleration.x,
//event.acceleration.y, event.acceleration.z);
}
}
// Check if we are exiting. // Check if we are exiting.
if (g_android.app->destroyRequested != 0) if (g_android.app->destroyRequested != 0)
return; return;
} }
} }
RARCH_LOG("Start RetroArch...\n"); RARCH_LOG("Starting RetroArch...\n");
rarch_main(argc, argv); rarch_main(argc, argv);
exit(0); exit(0);

View File

@ -57,10 +57,6 @@ static void gfx_ctx_destroy(void)
g_egl_surf = EGL_NO_SURFACE; g_egl_surf = EGL_NO_SURFACE;
g_egl_ctx = EGL_NO_CONTEXT; g_egl_ctx = EGL_NO_CONTEXT;
g_config = 0; g_config = 0;
g_android.width = 0;
g_android.height = 0;
g_android.animating = 0;
} }
static bool gfx_ctx_init(void) static bool gfx_ctx_init(void)
@ -118,8 +114,6 @@ static bool gfx_ctx_init(void)
!eglQuerySurface(g_egl_dpy, g_egl_surf, EGL_HEIGHT, &height)) !eglQuerySurface(g_egl_dpy, g_egl_surf, EGL_HEIGHT, &height))
goto error; goto error;
g_android.width = width;
g_android.height = height;
g_android.state.angle = 0; g_android.state.angle = 0;
return true; return true;