浏览代码

minor hl support

Nicolas Cannasse 9 年之前
父节点
当前提交
a492b4a202
共有 2 个文件被更改,包括 67 次插入12 次删除
  1. 3 3
      h3d/impl/Driver.hx
  2. 64 9
      hxd/System.hx

+ 3 - 3
h3d/impl/Driver.hx

@@ -21,9 +21,9 @@ typedef IndexBuffer = sdl.GL.Buffer;
 typedef VertexBuffer = { b : sdl.GL.Buffer, stride : Int };
 typedef Texture = { t : sdl.GL.Texture, width : Int, height : Int, internalFmt : Int, pixelFmt : Int, ?fb : sdl.GL.Framebuffer, ?rb : sdl.GL.Renderbuffer };
 #else
-typedef IndexBuffer = Int;
-typedef VertexBuffer = Int;
-typedef Texture = Int;
+typedef IndexBuffer = {};
+typedef VertexBuffer = {};
+typedef Texture = {};
 #end
 
 enum Feature {

+ 64 - 9
hxd/System.hx

@@ -157,9 +157,9 @@ class System {
 		var width = Std.parseInt(windowSize[0]), height = Std.parseInt(windowSize[1]);
 		if( width < 100 ) width = 100;
 		if ( height < 100 ) height = 100;
-		
+
 		var config = {
-			
+
 			build: "1",
 			company: "Heaps",
 			fps: 60,
@@ -167,7 +167,7 @@ class System {
 			packageName: "heaps.application",
 			version: "0.0.1",
 			windows: [
-				
+
 				{
 					antialiasing: 0,
 					background: 16777215,
@@ -187,12 +187,12 @@ class System {
 					y: null
 				},
 			]
-			
+
 		};
-		
+
 		var app = new openfl.display.Application ();
 		app.create (config);
-		
+
 		try {
 			callb();
 		} catch( e : Dynamic ) {
@@ -201,13 +201,13 @@ class System {
 			Sys.println(haxe.CallStack.toString(haxe.CallStack.exceptionStack()));
 			#end
 		}
-		
+
 		var result = app.exec ();
-		
+
 		#if sys
 		Sys.exit(result);
 		#end
-		
+
 		#else
 		callb();
 		#end
@@ -583,6 +583,61 @@ class System {
 		sdl.Sdl.quit();
 	}
 
+	#elseif hl
+
+	static var LOOP = null;
+
+	public static function exit() {
+		Sys.exit(0);
+	}
+
+	public static function start( init : Void -> Void ) {
+		init();
+		while( LOOP != null ) LOOP();
+	}
+
+	public static function setLoop( f : Void -> Void ) {
+		LOOP = f;
+	}
+
+	public static function setNativeCursor( c : Cursor ) {
+	}
+
+	static function get_screenDPI() {
+		return 72.;
+	}
+
+	static function get_lang() {
+		return "en";
+	}
+
+	static function get_isAndroid() {
+		return false;
+	}
+
+	public static function getClipboard() {
+		return "";
+	}
+
+	static function get_isIOS() {
+		return false;
+	}
+
+	static function get_isWindowed() {
+		return true;
+	}
+
+	static function get_isTouch() {
+		return false;
+	}
+
+	static function get_width() {
+		return 800;
+	}
+
+	static function get_height() {
+		return 600;
+	}
 
 	#end