Forráskód Böngészése

hxd.res.Texture -> hxd.res.Image

ncannasse 11 éve
szülő
commit
fc90f378e5
5 módosított fájl, 14 hozzáadás és 14 törlés
  1. 1 1
      h2d/css/Parser.hx
  2. 5 5
      hxd/res/Any.hx
  3. 1 1
      hxd/res/FileTree.hx
  4. 1 1
      hxd/res/Image.hx
  5. 6 6
      hxd/res/Loader.hx

+ 1 - 1
h2d/css/Parser.hx

@@ -553,7 +553,7 @@ class Parser {
 			url = url.substr(22);
 			if( StringTools.endsWith(url, "=") ) url = url.substr(0, -1);
 			var bytes = haxe.crypto.Base64.decode(url);
-			return hxd.res.Any.fromBytes("icon",bytes).getTexture().getPixels();
+			return hxd.res.Any.fromBytes("icon",bytes).toImage().getPixels();
 		default:
 			return null;
 		}

+ 5 - 5
hxd/res/Any.hx

@@ -36,19 +36,19 @@ class Any extends Resource {
 	}
 
 	public function toTexture() {
-		return loader.loadTexture(entry.path).toTexture();
+		return loader.loadImage(entry.path).toTexture();
 	}
 	
 	public function toTile() {
-		return loader.loadTexture(entry.path).toTile();
+		return loader.loadImage(entry.path).toTile();
 	}
 	
 	public function toString() {
 		return entry.getBytes().toString();
 	}
 
-	public function getTexture() {
-		return loader.loadTexture(entry.path);
+	public function toImage() {
+		return loader.loadImage(entry.path);
 	}
 	
 	public function toSound() {
@@ -60,7 +60,7 @@ class Any extends Resource {
 	}
 
 	public function toBitmap() {
-		return loader.loadTexture(entry.path).toBitmap();
+		return loader.loadImage(entry.path).toBitmap();
 	}
 
 	public function toBitmapFont() {

+ 1 - 1
hxd/res/FileTree.hx

@@ -309,7 +309,7 @@ class FileTree {
 		var epath = { expr : EConst(CString(relPath)), pos : pos };
 		switch( ext.toLowerCase() ) {
 		case "jpg", "png":
-			return { e : macro loader.loadTexture($epath), t : macro : hxd.res.Texture };
+			return { e : macro loader.loadImage($epath), t : macro : hxd.res.Image };
 		case "fbx", "xbx":
 			return { e : macro loader.loadModel($epath), t : macro : hxd.res.Model };
 		case "ttf":

+ 1 - 1
hxd/res/Texture.hx → hxd/res/Image.hx

@@ -1,6 +1,6 @@
 package hxd.res;
 
-class Texture extends Resource {
+class Image extends Resource {
 	
 	var needResize : Bool;
 	var tex : h3d.mat.Texture;

+ 6 - 6
hxd/res/Loader.hx

@@ -4,14 +4,14 @@ class Loader {
 	
 	public var fs(default,null) : FileSystem;
 	var modelCache : Map<String,Model>;
-	var textureCache : Map<String,Texture>;
+	var imageCache : Map<String,Image>;
 	var soundCache : Map<String,Sound>;
 	var fontCache : Map<String,BitmapFont>;
 	
 	public function new(fs) {
 		this.fs = fs;
 		modelCache = new Map();
-		textureCache = new Map();
+		imageCache = new Map();
 		soundCache = new Map();
 		fontCache = new Map();
 	}
@@ -33,11 +33,11 @@ class Loader {
 		return m;
 	}
 	
-	function loadTexture( path : String ) : Texture {
-		var t = textureCache.get(path);
+	function loadImage( path : String ) : Image {
+		var t = imageCache.get(path);
 		if( t == null ) {
-			t = new Texture(fs.get(path));
-			textureCache.set(path, t);
+			t = new Image(fs.get(path));
+			imageCache.set(path, t);
 		}
 		return t;
 	}