Final changes to text drawing system to make it appear correctly
Co-authored-by: r3cp3ct <45179536+r3cp3ct@users.noreply.github.com> Co-authored-by: sigonasr2 <sigonasr2@gmail.com>
This commit is contained in:
parent
e5dd00cff8
commit
636aac9bfc
@ -16,7 +16,7 @@ public class DrawLoop {
|
||||
|
||||
for (int y=0;y<RabiClone.BASE_HEIGHT;y++) {
|
||||
for (int x=0;x<RabiClone.BASE_WIDTH;x++) {
|
||||
p[y*RabiClone.BASE_WIDTH+x]=0;//RGB
|
||||
p[y*RabiClone.BASE_WIDTH+x]=(byte)PaletteColor.DARK_ORCHID.ordinal();//RGB
|
||||
}
|
||||
}
|
||||
|
||||
@ -40,14 +40,16 @@ public class DrawLoop {
|
||||
int xOffset=0;
|
||||
PaletteColor currentCol = col;
|
||||
for (int i=0;i<finalS.length();i++) {
|
||||
if (finalS.charAt(i)=='\u001a'&&i<finalS.length()-1) {
|
||||
if (finalS.charAt(i)==(char)26&&i<finalS.length()-1) {
|
||||
byte nextCol=Byte.parseByte(finalS.substring(i+1, finalS.indexOf(' ',i+1)));
|
||||
if (nextCol>=PaletteColor.values().length||nextCol<0) {
|
||||
throw new ArrayIndexOutOfBoundsException("Chosen color %"+nextCol+" is not in range (Min:0, Max: "+(PaletteColor.values().length-1)+")");
|
||||
} else {
|
||||
currentCol=PaletteColor.values()[nextCol];
|
||||
}
|
||||
finalS=finalS.replaceFirst(Pattern.quote("\u001a"+nextCol+" "),"");
|
||||
int oldLength = finalS.length();
|
||||
finalS=finalS.replaceFirst(Pattern.quote(Character.valueOf((char)26)+Byte.toString(nextCol)+" "),"");
|
||||
i--;
|
||||
} else
|
||||
if (finalS.charAt(i)=='\n') {
|
||||
xOffset+=(charCount+1)*f.getGlyphWidth();
|
||||
|
@ -37,7 +37,7 @@ public enum PaletteColor {
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "\u001a"+ordinal()+" ";
|
||||
return Character.valueOf((char)26)+Integer.toString(ordinal())+" ";
|
||||
}
|
||||
|
||||
|
||||
|
@ -152,8 +152,8 @@ public class EditorRenderer extends LevelRenderer{
|
||||
double tileY = y*Tile.TILE_HEIGHT-this.getY();
|
||||
DrawTransparentTile(tileX,tileY,selectedTile,Alpha.ALPHA160);
|
||||
Draw_Text(tileX+2,tileY-Font.PROFONT_12.getGlyphHeight()-2,new StringBuilder(selectedTile.toString()),Font.PROFONT_12);
|
||||
Draw_Text(tileX+2,tileY+2,new StringBuilder("View: ").append(PaletteColor.EMERALD).append(RabiClone.CURRENT_MAP.getView(x,y).ordinal()),Font.PROFONT_12);
|
||||
Draw_Text(tileX+2,tileY+Font.PROFONT_12.getGlyphHeight()+2,new StringBuilder("Type: ").append(PaletteColor.MIDNIGHT_BLUE).append(RabiClone.CURRENT_MAP.getType(x,y).ordinal()),Font.PROFONT_12);
|
||||
Draw_Text(tileX+2,tileY+2,new StringBuilder("View:").append(PaletteColor.EMERALD).append(RabiClone.CURRENT_MAP.getView(x,y).ordinal()),Font.PROFONT_12);
|
||||
Draw_Text(tileX+2,tileY+Font.PROFONT_12.getGlyphHeight()+2,new StringBuilder("Type:").append(PaletteColor.MIDNIGHT_BLUE).append(RabiClone.CURRENT_MAP.getType(x,y).ordinal()),Font.PROFONT_12);
|
||||
Draw_Text_Ext(tileX+2,tileY+Tile.TILE_HEIGHT+2,new StringBuilder(RabiClone.CURRENT_MAP.getTile(x,y).toString()),Font.PROFONT_12,Alpha.ALPHA0,PaletteColor.CRIMSON);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user