浏览代码

haxe 3.4.3 support fixes

ncannasse 7 年之前
父节点
当前提交
6cedd0c50d
共有 3 个文件被更改,包括 22 次插入8 次删除
  1. 11 1
      h3d/impl/DirectXDriver.hx
  2. 2 2
      hxd/System.hl.hx
  3. 9 5
      hxd/net/Socket.hx

+ 11 - 1
h3d/impl/DirectXDriver.hx

@@ -1,6 +1,16 @@
 package h3d.impl;
 
-#if hldx
+#if (hldx && haxe_ver < 4)
+
+class DirectXDriver extends h3d.impl.Driver {
+
+	public function new() {
+		throw "HL DirectX support requires Haxe 4.0+";
+	}
+
+}
+
+#elseif hldx
 
 import h3d.impl.Driver;
 import dx.Driver;

+ 2 - 2
hxd/System.hl.hx

@@ -282,7 +282,7 @@ class System {
 	}
 
 	static function get_allowTimeout() @:privateAccess {
-		#if usesys
+		#if (usesys || (haxe_ver < 4))
 		return false;
 		#else
 		return !sentinel.pause;
@@ -290,7 +290,7 @@ class System {
 	}
 
 	static function set_allowTimeout(b) @:privateAccess {
-		#if usesys
+		#if (usesys || (haxe_ver < 4))
 		return false;
 		#else
 		return sentinel.pause = !b;

+ 9 - 5
hxd/net/Socket.hx

@@ -40,7 +40,7 @@ class Socket {
 	var serv : flash.net.ServerSocket;
 	#end
 	#if hl
-	var s : hl.uv.Stream;
+	var s : #if (haxe_ver >= 4) hl.uv.Stream #else Dynamic #end;
 	#end
 	public var out(default, null) : SocketOutput;
 	public var input(default, null) : SocketInput;
@@ -48,8 +48,12 @@ class Socket {
 
 	public function new() {
 		out = new SocketOutput();
-		#if hl
-		hl.uv.Loop.register();
+		#if hl 
+			#if (haxe_ver >= 4)
+			hl.uv.Loop.register();
+			#else
+			throw "Not supported in Haxe 3.x";
+			#end
 		#end
 	}
 
@@ -73,7 +77,7 @@ class Socket {
 		});
 		bindEvents();
 		s.connect(host, port);
-		#elseif hl
+		#elseif (hl && haxe_ver >= 4)
 		var tcp = new hl.uv.Tcp();
 		s = tcp;
 		tcp.connect(new sys.net.Host(host), port, function(b) {
@@ -129,7 +133,7 @@ class Socket {
 			openedSocks.push(s);
 			onConnect(s);
 		});
-		#elseif hl
+		#elseif (hl && haxe_ver >= 4)
 		var tcp = new hl.uv.Tcp();
 		s = tcp;
 		try {