@@ -0,0 +1,1425 @@
+package com.blarg.gdx.graphics;%0A%0Aimport com.badlogic.gdx.graphics.Texture;%0Aimport com.badlogic.gdx.graphics.g2d.TextureRegion;%0Aimport com.badlogic.gdx.math.Rectangle;%0A%0Apublic class CustomGridTextureAtlas extends TextureAtlas %7B%0A%09public CustomGridTextureAtlas(Texture texture) %7B%0A%09%09this(texture, TEXCOORD_EDGE_BLEED_OFFSET);%0A%09%7D%0A%0A%09public CustomGridTextureAtlas(Texture texture, float edgeCoordOffset) %7B%0A%09%09super(texture, edgeCoordOffset);%0A%09%7D%0A%0A%09public int add(Rectangle rect) %7B%0A%09%09return add((int)rect.x, (int)rect.y, (int)rect.getWidth(), (int)rect.getHeight());%0A%09%7D%0A%0A%09public int add(int x, int y, int width, int height) %7B%0A%09%09// pixel location/dimensions%0A%09%09int left = x;%0A%09%09int top = y;%0A%09%09int right = left + width;%0A%09%09int bottom = top + height;%0A%0A%09%09// texture coordinates%0A%09%09// HACK: subtract edgeCoordOffset from the bottom right edges to%0A%09%09//       get around floating point rounding errors (adjacent tiles will%0A%09%09//       slightly bleed in otherwise)%0A%09%09float u = (left + edgeCoordOffset) / (float)texture.getWidth();%0A%09%09float v = (top + edgeCoordOffset) / (float)texture.getHeight();%0A%09%09float u2 = ((float)right - edgeCoordOffset) / (float)texture.getWidth();%0A%09%09float v2 = ((float)bottom - edgeCoordOffset) / (float)texture.getHeight();%0A%0A%09%09TextureRegion tile = new TextureRegion();%0A%09%09tile.setTexture(texture);%0A%09%09tile.setRegion(u, v, u2, v2);%0A%09%09tiles.add(tile);%0A%0A%09%09return tiles.size - 1;%0A%09%7D%0A%0A%09public void reset() %7B%0A%09%09tiles.clear();%0A%09%7D%0A%7D%0A

add CustomGridTextureAtlas