diff options
author | ultramn <dchapm2@umbc.edu> | 2017-05-14 18:23:36 -0700 |
---|---|---|
committer | ultramn <dchapm2@umbc.edu> | 2017-05-14 18:23:36 -0700 |
commit | 006af3f9b168fcde6892a22ae914b5b55634b2ca (patch) | |
tree | 992eb09f686e96be3b32c8933a4141a0d299f9ee /data_recorder.c | |
parent | 5936302543c19fbe0388ae8693f0fe16293d5258 (diff) | |
download | libsurvive-006af3f9b168fcde6892a22ae914b5b55634b2ca.tar.gz libsurvive-006af3f9b168fcde6892a22ae914b5b55634b2ca.tar.bz2 |
Fixed data recorder for OSX
Diffstat (limited to 'data_recorder.c')
-rw-r--r-- | data_recorder.c | 33 |
1 files 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); } |