mirror of
https://github.com/SquidDev-CC/CC-Tweaked
synced 2024-12-14 12:10:30 +00:00
Send terminal text and colours separately
This gives us slightly better compression, as backgrounds will often be a single run of colours while the foreground won't be. In practice, this is rarely an issue, as most terminals are small, but worth doing anyway.
This commit is contained in:
parent
3f0704624e
commit
1fd57a874f
@ -324,9 +324,9 @@ public class Terminal
|
||||
TextBuffer textColour = this.textColour[y];
|
||||
TextBuffer backColour = backgroundColour[y];
|
||||
|
||||
for( int x = 0; x < width; x++ ) buffer.writeByte( text.charAt( x ) & 0xFF );
|
||||
for( int x = 0; x < width; x++ )
|
||||
{
|
||||
buffer.writeByte( text.charAt( x ) & 0xFF );
|
||||
buffer.writeByte( getColour(
|
||||
backColour.charAt( x ), Colour.BLACK ) << 4 |
|
||||
getColour( textColour.charAt( x ), Colour.WHITE )
|
||||
@ -353,10 +353,9 @@ public class Terminal
|
||||
TextBuffer textColour = this.textColour[y];
|
||||
TextBuffer backColour = backgroundColour[y];
|
||||
|
||||
for( int x = 0; x < width; x++ ) text.setChar( x, (char) (buffer.readByte() & 0xFF) );
|
||||
for( int x = 0; x < width; x++ )
|
||||
{
|
||||
text.setChar( x, (char) (buffer.readByte() & 0xFF) );
|
||||
|
||||
byte colour = buffer.readByte();
|
||||
backColour.setChar( x, base16.charAt( (colour >> 4) & 0xF ) );
|
||||
textColour.setChar( x, base16.charAt( colour & 0xF ) );
|
||||
|
Loading…
Reference in New Issue
Block a user