allow terminal without half width font
This commit is contained in:
parent
16fdcee057
commit
477d08a1e3
|
@ -1,5 +1,5 @@
|
||||||
import com.danitheskunk.skunkworks.BaseGame;
|
package com.danitheskunk.skunkworks;
|
||||||
import com.danitheskunk.skunkworks.Vec2i;
|
|
||||||
import com.danitheskunk.skunkworks.gfx.Color;
|
import com.danitheskunk.skunkworks.gfx.Color;
|
||||||
import com.danitheskunk.skunkworks.gfx.IRenderContext;
|
import com.danitheskunk.skunkworks.gfx.IRenderContext;
|
||||||
import com.danitheskunk.skunkworks.gfx.vt.Terminal;
|
import com.danitheskunk.skunkworks.gfx.vt.Terminal;
|
|
@ -62,7 +62,7 @@ abstract public class BaseRenderContext implements IRenderContext {
|
||||||
var isHalfWidth = terminal.isHalfWidth(charPos);
|
var isHalfWidth = terminal.isHalfWidth(charPos);
|
||||||
|
|
||||||
drawTexture(pixelPos, fullFont.getTexture(0xdb), bgColor);
|
drawTexture(pixelPos, fullFont.getTexture(0xdb), bgColor);
|
||||||
if(isHalfWidth) {
|
if(isHalfWidth && halfFont != null) {
|
||||||
drawTexture(
|
drawTexture(
|
||||||
pixelPos,
|
pixelPos,
|
||||||
halfFont.getTexture(terminal.getLeftHalfChar(charPos)),
|
halfFont.getTexture(terminal.getLeftHalfChar(charPos)),
|
||||||
|
|
|
@ -50,6 +50,29 @@ public class Terminal {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Terminal(Vec2i size, IFont fullFont) {
|
||||||
|
this.cells = new ArrayList<>();
|
||||||
|
this.size = size;
|
||||||
|
this.fullFont = fullFont;
|
||||||
|
this.halfFont = null;
|
||||||
|
|
||||||
|
if(!fullFont.isMonospace()) {
|
||||||
|
throw new RuntimeException("Fonts need to be monospace");
|
||||||
|
}
|
||||||
|
|
||||||
|
this.fullCharSize = fullFont.getMonospaceSize();
|
||||||
|
|
||||||
|
for(int i = 0; i < size.getY() * size.getX(); ++i) {
|
||||||
|
var cell = new Cell();
|
||||||
|
cell.fullChar = 0;
|
||||||
|
cell.secondChar = 0;
|
||||||
|
cell.halfWidth = false;
|
||||||
|
cell.bgColor = Color.BLACK;
|
||||||
|
cell.fgColor = Color.WHITE;
|
||||||
|
cells.add(cell);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public Vec2i getFullCharSize() {
|
public Vec2i getFullCharSize() {
|
||||||
return fullCharSize;
|
return fullCharSize;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue