|
public abstract class TextureSize
{
protected int width;
protected int height;
protected int maxSize;
protected int minSize;
public void setMaxSize(int maxSize)
{
this.maxSize = maxSize;
}
public TextureSize(int maxSize)
{
this.width = 0;
this.height = 0;
this.maxSize = maxSize;
this.minSize = 32;
}
public int getNumPixels()
{
return width*height;
}
public boolean isMaxSize()
{
return width == maxSize && height == maxSize;
}
public boolean isMinSize()
{
return width == minSize && height == minSize;
}
protected void checkMax()
{
if (width > maxSize)
width = maxSize;
if (height > maxSize)
height = maxSize;
}
protected void checkMin()
{
if (width < minSize)
width = minSize;
if (height < minSize)
height = minSize;
}
public int getHeight()
{
return height;
}
public void setHeight(int height)
{
this.height = height;
}
public void setSize(int width, int height)
{
this.width = width;
this.height = height;
}
public int getWidth()
{
return width;
}
public void setWidth(int width)
{
this.width = width;
}
abstract public void inc();
abstract public void dec();
abstract public void getNextSizeFits(int pixelsReq, int maxWidth, int maxHeight);
abstract public boolean isNPOT();
}
|
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.