From 006af3f9b168fcde6892a22ae914b5b55634b2ca Mon Sep 17 00:00:00 2001 From: ultramn Date: Sun, 14 May 2017 18:23:36 -0700 Subject: Fixed data recorder for OSX --- data_recorder.c | 33 +++++++++++++++++++++++---------- 1 file changed, 23 insertions(+), 10 deletions(-) diff --git a/data_recorder.c b/data_recorder.c index 5504d42..19bf712 100644 --- a/data_recorder.c +++ b/data_recorder.c @@ -94,6 +94,10 @@ void my_imu_process( struct SurviveObject * so, int mask, FLT * accelgyro, uint3 void * GuiThread( void * v ) { + CNFGBGColor = 0x000000; + CNFGDialogColor = 0x444444; + CNFGSetup( "Survive GUI Debug", 640, 480 ); + short screenx, screeny; while(1) { @@ -122,37 +126,46 @@ void * GuiThread( void * v ) } } - CNFGSwapBuffers(); OGUSleep( 10000 ); } } +int SurviveThreadLoaded=0; - -int main() +void *SurviveThread(void *junk) { ctx = survive_init( 0 ); survive_install_light_fn( ctx, my_light_process ); survive_install_imu_fn( ctx, my_imu_process ); - - CNFGBGColor = 0x000000; - CNFGDialogColor = 0x444444; - CNFGSetup( "Survive GUI Debug", 640, 480 ); - OGCreateThread( GuiThread, 0 ); - - if( !ctx ) { fprintf( stderr, "Fatal. Could not start\n" ); return 1; } + SurviveThreadLoaded = 1; + while(survive_poll(ctx) == 0) { + printf("Do stuff.\n"); //Do stuff. } + + return 0; +} + +int main() +{ + // Create the libsurvive thread + OGCreateThread(SurviveThread, 0); + + // Wait for the survive thread to load + while (!SurviveThreadLoaded) { OGUSleep(100); } + + // Run the Gui in the main thread + GuiThread(0); } -- cgit v1.2.3