public LTexture GetTexture(string name) { this.Pack(); PackEntry entry = GetEntry(name); if (entry == null) { return(null); } return(texture.GetSubTexture(entry.bounds.left, entry.bounds.top, entry.bounds.right, entry.bounds.bottom)); }
public static LTexture[][] GetSplit2Textures(LTexture image, int width, int height) { if (image == null) { return(null); } if (!image.IsLoaded()) { image.LoadTexture(); } int wlength = image.GetWidth() / width; int hlength = image.GetHeight() / height; LTexture[][] textures = (LTexture[][])CollectionUtils.XNA_CreateJaggedArray(typeof(LTexture), wlength, hlength); for (int y = 0; y < hlength; y++) { for (int x = 0; x < wlength; x++) { textures[x][y] = image.GetSubTexture((x * width), (y * height), width, height); } } return(textures); }
public static LTexture[] GetSplitTextures(LTexture image, int width, int height) { if (image == null) { return(null); } if (!image.IsLoaded()) { image.LoadTexture(); } int frame = 0; int wlength = image.GetWidth() / width; int hlength = image.GetHeight() / height; int total = wlength * hlength; LTexture[] images = new LTexture[total]; for (int y = 0; y < hlength; y++) { for (int x = 0; x < wlength; x++) { images[frame] = image.GetSubTexture((x * width), (y * height), width, height); frame++; } } return(images); }
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 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[] GetSplitTextures(LTexture image, int width, int height) { if (image == null) { return null; } if (!image.IsLoaded()) { image.LoadTexture(); } int frame = 0; int wlength = image.GetWidth() / width; int hlength = image.GetHeight() / height; int total = wlength * hlength; LTexture[] images = new LTexture[total]; for (int y = 0; y < hlength; y++) { for (int x = 0; x < wlength; x++) { images[frame] = image.GetSubTexture((x * width), (y * height), width, height); frame++; } } return images; }
public static LTexture[][] GetSplit2Textures(LTexture image, int width, int height) { if (image == null) { return null; } if (!image.IsLoaded()) { image.LoadTexture(); } int wlength = image.GetWidth() / width; int hlength = image.GetHeight() / height; LTexture[][] textures = (LTexture[][])CollectionUtils.XNA_CreateJaggedArray(typeof(LTexture), wlength, hlength); for (int y = 0; y < hlength; y++) { for (int x = 0; x < wlength; x++) { textures[x][y] = image.GetSubTexture((x * width), (y * height), width, height); } } return textures; }