public LTexture LoadTexture(string name) { if (imageList == null) { throw new Exception("Xml data not loaded !"); } ImageData data = (ImageData)CollectionUtils.Get(imageList, name); if (data == null) { throw new Exception("No such image reference: '" + name + "'"); } if (this.values[data.index] != null) { return(this.values[data.index].texture); } LTexture img = null; if (data.mask != null) { img = TextureUtils.FilterColor(data.xref, data.mask, data.scaleType == 0 ? Loon.Core.Graphics.Opengl.LTexture.Format.DEFAULT : Loon.Core.Graphics.Opengl.LTexture.Format.LINEAR); } else { img = LTextures.LoadTexture(data.xref, data.scaleType == 0 ? Loon.Core.Graphics.Opengl.LTexture.Format.DEFAULT : Loon.Core.Graphics.Opengl.LTexture.Format.LINEAR); } if ((data.w != 0) && (data.h != 0)) { img = img.GetSubTexture(data.x, data.y, data.w, data.h); } if (data.scale != 0) { img = img.Scale(data.scale); } this.values[data.index] = new LTextureObject(img, 0, 0); return(img); }
public static LTexture FilterColor(string res, LColor height) { return(TextureUtils.FilterColor(res, height, Loon.Core.Graphics.Opengl.LTexture.Format.DEFAULT)); }
public static LTexture FilterColor(string res, Color[] colors) { return(TextureUtils.FilterColor(res, colors, Loon.Core.Graphics.Opengl.LTexture.Format.DEFAULT)); }