From 5936302543c19fbe0388ae8693f0fe16293d5258 Mon Sep 17 00:00:00 2001 From: ultramn Date: Sun, 14 May 2017 18:23:14 -0700 Subject: Fixed calibrate.c for OSX --- calibrate.c | 27 +++++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-) (limited to 'calibrate.c') diff --git a/calibrate.c b/calibrate.c index 9633a77..28e920a 100644 --- a/calibrate.c +++ b/calibrate.c @@ -1,4 +1,4 @@ -//Data recorder mod with GUI showing light positions. +// recorder mod with GUI showing light positions. #include #include @@ -102,7 +102,7 @@ void my_angle_process( struct SurviveObject * so, int sensor_id, int acode, uint char* sensor_name[32]; -void * GuiThread( void * v ) +void * GuiThread( void * jnk ) { short screenx, screeny; CNFGBGColor = 0x000000; @@ -161,10 +161,9 @@ void * GuiThread( void * v ) } } +int SurviveThreadLoaded=0; - - -int main() +void * SurviveThread(void *jnk) { ctx = survive_init( 0 ); @@ -180,23 +179,35 @@ int main() survive_cal_install( ctx ); - OGCreateThread( GuiThread, 0 ); - - if( !ctx ) { fprintf( stderr, "Fatal. Could not start\n" ); return 1; } + SurviveThreadLoaded=1; + while(survive_poll(ctx) == 0 && !quit) { //Do stuff. } survive_close( ctx ); +} + + +int main() +{ + // Create the survive thread + OGCreateThread( SurviveThread, 0 ); + + // Wait for the survive thread to load + while(!SurviveThreadLoaded){ OGUSleep(100); } + // Run the GUI in the main thread + GuiThread(0); printf( "Returned\n" ); + return 0; } -- cgit v1.2.3