public static LTexture[] GetDivide(string fileName, int count, int[] width, int[] height) { if (count <= 0) { throw new Exception("Divide"); } LTexture image = LTextures.LoadTexture(fileName); if (image == null) { return(null); } if (!image.IsLoaded()) { image.LoadTexture(); } if (width == null) { width = new int[count]; int w = image.GetWidth(); for (int j = 0; j < count; j++) { width[j] = w / count; } } if (height == null) { height = new int[count]; int h = image.GetHeight(); for (int i = 0; i < count; i++) { height[i] = h; } } LTexture[] images = new LTexture[count]; int offsetX = 0; for (int i = 0; i < count; i++) { images[i] = image.GetSubTexture(offsetX, 0, width[i], height[i]); offsetX += width[i]; } return(images); }
public void LoadTexture() { if (parent != null) { parent.LoadTexture(); textureID = parent.textureID; isLoaded = parent.isLoaded; return; } if (imageData == null || isLoaded) { return; } isLoaded = true; LoadTextureBuffer(); SetFormat(format); LTextures.LoadTexture(this); LTextureBatch.isBatchCacheDitry = true; }
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[][] GetSplit2Textures(string fileName, int width, int height) { return(GetSplit2Textures(LTextures.LoadTexture(fileName), width, height)); }
public static LTexture LoadTexture(string fileName) { return(LTextures.LoadTexture(fileName)); }
public int Add(string res, float x, float y) { return(Add(new LTextureObject(LTextures.LoadTexture(res), x, y))); }
public LTextureRegion(string file, int x, int y, int width, int height) : this(LTextures.LoadTexture(file), x, y, width, height) { }
public LTextureRegion(string file, Loon.Core.Graphics.Opengl.LTexture.Format f) : this(LTextures.LoadTexture(file, f)) { }
public int Add(string res, Loon.Core.Graphics.Opengl.LTexture.Format format, float x, float y) { return(Add(new LTextureObject(LTextures.LoadTexture(res, format), x, y))); }