/// <summary> /// Constructs a JTexture from a parent texture /// </summary> /// <param name="parent"></param> /// <param name="topLeftX"></param> /// <param name="topLeftY"></param> /// <param name="width"></param> /// <param name="height"></param> public JTexture(JTexture parent, float topLeftX, float topLeftY, float width, float height, bool alpha) { if (topLeftX < 0 || topLeftY < 0 || topLeftX + width > parent.w || topLeftY + height > parent.h) { throw new ArgumentException("Attempted to define a sub JTexture outside the bounds of the parent"); } isSubTexture = true; _GLTexID = parent.GLTexID; _hasAlpha = parent.hasAlpha; useAlpha = alpha; _w = width; _h = height; float parentTextureW = parent.topRight.X - parent.bottomLeft.X; float parentTextureH = parent.topRight.Y - parent.bottomLeft.Y; bottomLeft.X = parent.bottomLeft.X + (float)topLeftX * parentTextureW / parent.w; topRight.X = parent.bottomLeft.X + (float)(topLeftX + width) * parentTextureW / parent.w; bottomLeft.Y = parent.bottomLeft.Y + (1 - (float)(topLeftY + height) / parent.h) * parentTextureH; topRight.Y = parent.bottomLeft.Y + (1 - (float)topLeftY / parent.h) * parentTextureH; }
public void Remove(JTexture textureToRemove) { textureList.Remove(textureToRemove); textureToRemove.Free(); }
public JTexture Add(JTexture texture) { textureList.Add(texture); return texture; }
public JTexture Add(JTexture texture) { textureList.Add(texture); return(texture); }