45 lines
795 B
Java
45 lines
795 B
Java
package com.danitheskunk.skunkworks.gfx.font;
|
|
|
|
import com.danitheskunk.skunkworks.Vec2i;
|
|
import com.danitheskunk.skunkworks.gfx.ITexture;
|
|
|
|
import java.util.List;
|
|
|
|
public class FontTileset implements IFont {
|
|
private List<ITexture> textures;
|
|
private Vec2i charSize;
|
|
|
|
public FontTileset(List<ITexture> textures) {
|
|
this.textures = textures;
|
|
this.charSize = textures.get(0).getSize();
|
|
}
|
|
|
|
@Override
|
|
public int getXAdvance(int ch) {
|
|
return charSize.getX();
|
|
}
|
|
|
|
@Override
|
|
public boolean isCP437() {
|
|
return true;
|
|
}
|
|
|
|
@Override
|
|
public int getLineHeight(int ch) {
|
|
return charSize.getY();
|
|
}
|
|
|
|
@Override
|
|
public Vec2i getOffset(int ch) {
|
|
return Vec2i.ZERO;
|
|
}
|
|
|
|
@Override
|
|
public ITexture getTexture(int ch) {
|
|
if(ch >= 256 || ch < 0) {
|
|
ch = 0;
|
|
}
|
|
return textures.get(ch);
|
|
}
|
|
}
|