Browse Source

Move timeoutTick to the static initializer (#933)

Dmitry Hryppa 4 years ago
parent
commit
b268ca47b9
1 changed files with 4 additions and 2 deletions
  1. 4 2
      hxd/System.hl.hx

+ 4 - 2
hxd/System.hl.hx

@@ -419,7 +419,6 @@ class System {
 		#if !usesys
 		hl.Api.setErrorHandler(function(e) reportError(e)); // initialization error
 		sentinel = new hl.UI.Sentinel(30, function() throw "Program timeout (infinite loop?)");
-		haxe.MainLoop.add(timeoutTick, -1) #if (haxe_ver >= 4) .isBlocking = false #end;
 		#end
 		#if ( target.threaded && (haxe_ver >= 4.2) )
 		mainThread = sys.thread.Thread.current();
@@ -427,7 +426,10 @@ class System {
 	}
 	
 	#if (hlsdl || hldx)
-	static var _ = haxe.MainLoop.add(updateCursor, -1) #if (haxe_ver >= 4) .isBlocking = false #end;
+	static var _ = {
+		haxe.MainLoop.add(timeoutTick, -1) #if (haxe_ver >= 4) .isBlocking = false #end;
+		haxe.MainLoop.add(updateCursor, -1) #if (haxe_ver >= 4) .isBlocking = false #end;
+	}
 	#end
 
 }