|
public class TextureSize
{
protected int width;
protected int height;
protected int ixSize;
public TextureSize(int width, int height)
{
this.width = width;
this.height = height;
ixSize = 0;
}
public int getNumPixels()
{
return width*height;
}
public int getHeight()
{
return height;
}
public void setHeight(int height)
{
this.height = height;
}
public int getWidth()
{
return width;
}
public void setWidth(int width)
{
this.width = width;
}
public void incTextureSize()
{
// swap height and width if it's not square
// this is to allow for better fitting of width and tall images
if (height > width && ixSize % 1 == 0)
{
int temp = height;
height = width;
width = temp;
}
else if (height > width)
width *= 2;
else
height *= 2;
ixSize++;
}
public boolean isMaxSize()
{
return height == 1024 && width == 1024;
}
public TextureSize clone()
{
return new TextureSize(32, 32);
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
After working in the software industry for many years, I've started my own
games company that specialises in strategy games for mobile platforms.