v3.2.2: adjusted itemspritesheet to not longer init with texture ref

This commit is contained in:
Evan Debenham
2025-08-25 11:26:03 -04:00
parent 01bc465114
commit 31ddefce35
2 changed files with 26 additions and 2 deletions

View File

@@ -90,6 +90,26 @@ public class TextureFilm {
}
}
}
//creates a film for a texture with known size without needing to reference it
public TextureFilm( int txWidth, int txHeight, int width, int height){
texWidth = txWidth;
texHeight = txHeight;
float uw = (float)width / texWidth;
float vh = (float)height / texHeight;
int cols = texWidth / width;
int rows = texHeight / height;
for (int i=0; i < rows; i++) {
for (int j=0; j < cols; j++) {
RectF rect = new RectF( j * uw, i * vh, (j+1) * uw, (i+1) * vh );
add( i * cols + j, rect );
}
}
}
public void add( Object id, RectF rect ) {
frames.put( id, rect );