Browse Source

Added resouce processing for

Hugh Sanderson 16 years ago
parent
commit
f891999afa
1 changed files with 12 additions and 0 deletions
  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 }>;