浏览代码

Added resouce processing for

Hugh Sanderson 16 年之前
父节点
当前提交
f891999afa
共有 1 个文件被更改,包括 12 次插入0 次删除
  1. 12 0
      std/haxe/Resource.hx

+ 12 - 0
std/haxe/Resource.hx

@@ -52,6 +52,18 @@ class Resource {
 	public static function getBytes( name : String ) {
 		return php.io.File.getBytes(getPath(name));
 	}
+#elseif cpp
+	public static function listNames() : Array<String> {
+		return untyped __global__.__hxcpp_resource_names();
+	}
+	public static function getString(name:String) : String {
+		return untyped __global__.__hxcpp_resource_string(name);
+	}
+	public static function getBytes(name:String) : haxe.io.Bytes {
+		var array:haxe.io.BytesData = untyped __global__.__hxcpp_resource_bytes(name);
+		if (array==null) return null;
+		return haxe.io.Bytes.ofData(array);
+	}
 #else
 	static var content : Array<{ name : String, data : String }>;