aboutsummaryrefslogtreecommitdiff
path: root/calibrate.c
diff options
context:
space:
mode:
authorultramn <dchapm2@umbc.edu>2017-05-14 18:23:14 -0700
committerultramn <dchapm2@umbc.edu>2017-05-14 18:23:14 -0700
commit5936302543c19fbe0388ae8693f0fe16293d5258 (patch)
tree71f6766d64606cbc400c7f50acd982ab0cf96be4 /calibrate.c
parenta5b10b5d8c7568b1b37a0757a64388f3124e3be2 (diff)
downloadlibsurvive-5936302543c19fbe0388ae8693f0fe16293d5258.tar.gz
libsurvive-5936302543c19fbe0388ae8693f0fe16293d5258.tar.bz2
Fixed calibrate.c for OSX
Diffstat (limited to 'calibrate.c')
-rw-r--r--calibrate.c27
1 files changed, 19 insertions, 8 deletions
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 <stdio.h>
#include <stdlib.h>
@@ -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;
}