mirror of
https://github.com/Orama-Interactive/Pixelorama.git
synced 2025-01-19 01:29:49 +00:00
c6b9a1fb82
* gdformat . * Lint code - Part 1 * Format code - Part 2 * Lint code - Part 2 Trying to fix the max allowed line length errors * Add normal_map_invert_y to the image .import files Because of Godot 3.4 * Do not call private methods outside of the script's scope Lint code - Part 3 * Format code - Part 3 * Fixed more line length exceeded errors - Lint code Part 3 * Export array of licenses - Lint code part 4 * Clean hint_tooltip code from Global Removes a lot of lines of code * Create static-checks.yml * Fix FreeType's license
32 lines
586 B
GDScript
32 lines
586 B
GDScript
extends Reference
|
|
|
|
|
|
class LSBLZWBitPacker:
|
|
var bit_index: int = 0
|
|
var stream: int = 0
|
|
|
|
var chunks: PoolByteArray = PoolByteArray([])
|
|
|
|
func put_byte():
|
|
chunks.append(stream & 0xff)
|
|
bit_index -= 8
|
|
stream >>= 8
|
|
|
|
func write_bits(value: int, bits_count: int) -> void:
|
|
value &= (1 << bits_count) - 1
|
|
value <<= bit_index
|
|
stream |= value
|
|
bit_index += bits_count
|
|
while bit_index >= 8:
|
|
self.put_byte()
|
|
|
|
func pack() -> PoolByteArray:
|
|
if bit_index != 0:
|
|
self.put_byte()
|
|
return chunks
|
|
|
|
func reset() -> void:
|
|
bit_index = 0
|
|
stream = 0
|
|
chunks = PoolByteArray([])
|