Itâ€™s so simple but should be easier if I donâ€™t have to redo both TbtQuad and TbtQuadBackgroundComponent

```
public class ExTbtQuad extends Mesh
implements Cloneable{
private Vector2f size;
private Vector2f imageSize;
private float[] horzFolds;
private float[] vertFolds;
private float[] horzTexCoords;
private float[] vertTexCoords;
float offsetX, offsetY;
public ExTbtQuad(float width, float height) {
this.size = new Vector2f(width, height);
this.imageSize = new Vector2f(width, height);
this.horzFolds = new float[]{width / 3f, 2 * width / 3f};
this.vertFolds = new float[]{height / 3f, 2 * height / 3f};
this.horzTexCoords = new float[]{0, 1 / 3f, 2 / 3f, 1};
this.vertTexCoords = new float[]{0, 1 / 3f, 2 / 3f, 1};
refreshGeometry();
}
public ExTbtQuad(float width, float height, int x1, int y1, int x2, int y2, int imageWidth, int imageHeight, int ox, int oy, float imageScale) {
this.size = new Vector2f(width, height);
float iw = imageWidth * imageScale;
float ih = imageHeight * imageScale;
this.imageSize = new Vector2f(iw, ih);
this.horzFolds = new float[]{imageScale * x1, imageScale * x2};
this.vertFolds = new float[]{imageScale * y1, imageScale * y2};
// Slide the far end necessary to make the proper width
// and height
horzFolds[1] += width - iw;
vertFolds[1] += height - ih;
//THIS IS WHAT I ADD :)
this.offsetX = ox / iw;
this.offsetY = oy / ih;
this.horzTexCoords = new float[]{0 + offsetX, (float) x1 / imageWidth + offsetX, (float) x2 / imageWidth + offsetX, 1 + offsetX};
this.vertTexCoords = new float[]{0 + offsetY, (float) y1 / imageHeight + offsetY, (float) y2 / imageHeight + offsetY, 1 + offsetY};
refreshGeometry();
}
public ExTbtQuad clone() {
ExTbtQuad result = (ExTbtQuad) super.deepClone();
result.size = size.clone();
result.imageSize = imageSize.clone();
result.horzFolds = horzFolds.clone();
result.vertFolds = vertFolds.clone();
result.horzTexCoords = horzTexCoords.clone();
result.vertTexCoords = vertTexCoords.clone();
return result;
}
public Vector2f getSize() {
return size;
}
public void updateSize(float width, float height) {
if (size.x == width && size.y == height) {
return;
}
// Put back the size adjustment we made in the first place
horzFolds[1] -= size.x - imageSize.x;
vertFolds[1] -= size.y - imageSize.y;
size.set(width, height);
// Adjust the middle fold for the new size
horzFolds[1] += size.x - imageSize.x;
vertFolds[1] += size.y - imageSize.y;
refreshGeometry();
}
protected void refreshGeometry() {
setBuffer(Type.Index, 3, new short[]{
0, 1, 12,
0, 12, 11,
1, 2, 13,
1, 13, 12,
2, 3, 13,
3, 4, 13,
13, 4, 5,
13, 5, 14,
14, 5, 6,
14, 6, 7,
15, 14, 7,
15, 7, 8,
10, 15, 9,
15, 8, 9,
11, 12, 15,
11, 15, 10,
// The center
12, 13, 14,
12, 14, 15
});
setBuffer(Type.Position, 3, new float[]{
0, 0, 0,
horzFolds[0], 0, 0,
horzFolds[1], 0, 0,
size.x, 0, 0,
size.x, vertFolds[0], 0,
size.x, vertFolds[1], 0,
size.x, size.y, 0,
horzFolds[1], size.y, 0,
horzFolds[0], size.y, 0,
0, size.y, 0,
0, vertFolds[1], 0,
0, vertFolds[0], 0,
// The center
horzFolds[0], vertFolds[0], 0,
horzFolds[1], vertFolds[0], 0,
horzFolds[1], vertFolds[1], 0,
horzFolds[0], vertFolds[1], 0
});
setBuffer(Type.TexCoord, 2, new float[]{
horzTexCoords[0], vertTexCoords[0],
horzTexCoords[1], vertTexCoords[0],
horzTexCoords[2], vertTexCoords[0],
horzTexCoords[3], vertTexCoords[0],
horzTexCoords[3], vertTexCoords[1],
horzTexCoords[3], vertTexCoords[2],
horzTexCoords[3], vertTexCoords[3],
horzTexCoords[2], vertTexCoords[3],
horzTexCoords[1], vertTexCoords[3],
horzTexCoords[0], vertTexCoords[3],
horzTexCoords[0], vertTexCoords[2],
horzTexCoords[0], vertTexCoords[1],
// The center
horzTexCoords[1], vertTexCoords[1],
horzTexCoords[2], vertTexCoords[1],
horzTexCoords[2], vertTexCoords[2],
horzTexCoords[1], vertTexCoords[2]
});
setBuffer(Type.Normal, 3, new float[]{
0, 0, 1,
0, 0, 1,
0, 0, 1,
0, 0, 1,
0, 0, 1,
0, 0, 1,
0, 0, 1,
0, 0, 1,
0, 0, 1,
0, 0, 1,
0, 0, 1,
0, 0, 1,
// The center
0, 0, 1,
0, 0, 1,
0, 0, 1,
0, 0, 1
});
updateBound();
}
}
```