boxddd-sys 0.4.0

Low-level FFI bindings for Box3D built from vendored upstream sources
Documentation
diff --git a/src/timer.c b/src/timer.c
--- a/src/timer.c
+++ b/src/timer.c
@@ -225,8 +225,117 @@ void b3JoinThread( b3Thread* t )
 	b3Free( t, sizeof( b3Thread ) );
 }
 
-#elif defined( __linux__ ) || defined( __EMSCRIPTEN__ )
+#elif defined( __EMSCRIPTEN__ ) && defined( BOX3D_WASM_SINGLE_THREADED )
 
+#include <emscripten/emscripten.h>
+
+uint64_t b3GetTicks( void )
+{
+	return (uint64_t)( emscripten_get_now() * 1000000.0 );
+}
+
+float b3GetMilliseconds( uint64_t ticks )
+{
+	uint64_t ticksNow = b3GetTicks();
+	return (float)( ( ticksNow - ticks ) / 1000000.0 );
+}
+
+float b3GetMillisecondsAndReset( uint64_t* ticks )
+{
+	uint64_t ticksNow = b3GetTicks();
+	float ms = (float)( ( ticksNow - *ticks ) / 1000000.0 );
+	*ticks = ticksNow;
+	return ms;
+}
+
+void b3Yield( void )
+{
+}
+
+void b3Sleep( int milliseconds )
+{
+	(void)milliseconds;
+}
+
+typedef struct b3Mutex
+{
+	int unused;
+} b3Mutex;
+
+b3Mutex* b3CreateMutex( void )
+{
+	b3Mutex* mutex = b3Alloc( sizeof( b3Mutex ) );
+	mutex->unused = 0;
+	return mutex;
+}
+
+void b3DestroyMutex( b3Mutex* mutex )
+{
+	*mutex = (b3Mutex){ 0 };
+	b3Free( mutex, sizeof( b3Mutex ) );
+}
+
+void b3LockMutex( b3Mutex* mutex )
+{
+	(void)mutex;
+}
+
+void b3UnlockMutex( b3Mutex* mutex )
+{
+	(void)mutex;
+}
+
+typedef struct b3Semaphore
+{
+	int unused;
+} b3Semaphore;
+
+b3Semaphore* b3CreateSemaphore( int initCount )
+{
+	b3Semaphore* semaphore = b3Alloc( sizeof( b3Semaphore ) );
+	(void)initCount;
+	semaphore->unused = 0;
+	return semaphore;
+}
+
+void b3DestroySemaphore( b3Semaphore* semaphore )
+{
+	*semaphore = (b3Semaphore){ 0 };
+	b3Free( semaphore, sizeof( b3Semaphore ) );
+}
+
+void b3WaitSemaphore( b3Semaphore* semaphore )
+{
+	(void)semaphore;
+}
+
+void b3SignalSemaphore( b3Semaphore* semaphore )
+{
+	(void)semaphore;
+}
+
+typedef struct b3Thread
+{
+	int unused;
+} b3Thread;
+
+b3Thread* b3CreateThread( b3ThreadFunction* function, void* context, const char* name )
+{
+	(void)name;
+	function( context );
+	b3Thread* thread = b3Alloc( sizeof( b3Thread ) );
+	thread->unused = 0;
+	return thread;
+}
+
+void b3JoinThread( b3Thread* thread )
+{
+	*thread = (b3Thread){ 0 };
+	b3Free( thread, sizeof( b3Thread ) );
+}
+
+#elif defined( __linux__ )
+
 #include <sched.h>
 #include <time.h>