v3.2.2: adjusted itemspritesheet to not longer init with texture ref
This commit is contained in:
@@ -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 );
|
||||
|
||||
Reference in New Issue
Block a user