|
|
|
@ -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(); |
|
|
|
|