11-18-2012 07:57 AM
I have a tilt based game, Wacky Rapids, it is already available on the Eval App World server for BB10. Upon testing it today, without the debugger attached, the tilt control suddenly stopped working. I can still interact with the application by touch (accessing menus, restarting levels, etc.) I spent sometime attempting to attach to the process via the debugger however this wasn't possible (another thread has been created for this issue).
I haven't seen this issue before, but I believe it is a bug, outside of my code. My basic code set up is:
screen_request_events( context );
if ( sensor_is_supported( SENSOR_TYPE_ACCELEROMETER ) )
if ( const char * orientation = getenv( "ORIENTATION" ) )
sensor_remap_coordinates( atoi( orientation ) );
int hr = sensor_set_rate( SENSOR_TYPE_ACCELEROMETER, 25000 );
PiAssert( hr == BPS_SUCCESS, "sensor_set_rate( SENSOR_TYPE_ACCELEROMETER, 25000 ) failed" );
hr = sensor_request_events( SENSOR_TYPE_ACCELEROMETER );
PiAssert( hr == BPS_SUCCESS, "sensor_request_events( SENSOR_TYPE_ACCELEROMETER ) failed" );
switch ( bps_event_get_code( event ) )
float x, y, z;
sensor_event_get_xyz( event, &x, &y, &z );
// Engine then takes values and handles them generically across all platforms/games
I can't provide anything more details unforunately, I have only seen this happen one time, and upon restarting the application the tilt starting working again. It seems as though (for what ever reason) it stopped generating acceleromoeter events, OR, it was generating events but the x,y,z values being returned were always 0. Other than the code above, the engine code/game code that deals with the tilt is generic across multiple platforms and titles, and it has only appeared so far on BB10 (by the by, only on the latest NDK, but as it only one time so far that doesn't mean too much).