mirror of
				https://github.com/SquidDev-CC/CC-Tweaked
				synced 2025-10-30 21:23:00 +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:
		| @@ -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 ) ); | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Jonathan Coates
					Jonathan Coates