public static void EnterMainLoop(RunLoop.RunLoopDelegate runLoopDelegate) { while (true) { if (runLoopDelegate() == false) { break; } } }
public static void EnterMainLoop(RunLoop.RunLoopDelegate runLoopDelegate) { // From `Marshal.GetFunctionPointerForDelegate` documentation: // (https://docs.microsoft.com/en-us/dotnet/api/system.runtime.interopservices.marshal.getfunctionpointerfordelegate) // You must manually keep the delegate from being collected by the garbage collector from managed code. // The garbage collector does not track references to unmanaged code. staticManagedDelegate = (RunLoop.RunLoopDelegate)ManagedRAFCallback; staticM = runLoopDelegate; HTMLNativeCalls.set_animation_frame_callback(Marshal.GetFunctionPointerForDelegate(staticManagedDelegate)); Console.WriteLine("HTML Main loop exiting."); }
public static void EnterMainLoop(RunLoop.RunLoopDelegate runLoopDelegate) { while (true) { double timestampInSeconds = GetSecondsMonotonic(); if (runLoopDelegate(timestampInSeconds) == false) { break; } } PlatformEvents.SendQuitEvent(null, new QuitEvent()); }
public static void EnterMainLoop(RunLoop.RunLoopDelegate runLoopDelegate) { staticManagedDelegate = (RunLoop.RunLoopDelegate)ManagedRAFCallback; staticM = runLoopDelegate; iOSNativeCalls.set_animation_frame_callback(Marshal.GetFunctionPointerForDelegate(staticManagedDelegate)); }