mirror of
https://port.numenaute.org/aleajactaest/bazar_alea.git
synced 2024-11-09 08:49:03 +00:00
31 lines
593 B
GDScript
31 lines
593 B
GDScript
class_name PackedFlowPull
|
|
|
|
var data:PackedByteArray = PackedByteArray()
|
|
|
|
var offset:int = 0
|
|
|
|
func _init(dataSrc:ENetPacketPeer) -> void:
|
|
if dataSrc != null:
|
|
self.data = dataSrc.get_packet()
|
|
else:
|
|
self.data.clear()
|
|
self.offset = 0
|
|
|
|
func get_u8() -> int:
|
|
var ret:int
|
|
#print(self.data.size(), " - " , self.offset)
|
|
ret = self.data[self.offset]
|
|
self.offset += 1
|
|
return ret
|
|
|
|
func get_u64() -> int:
|
|
var ret:int
|
|
ret = data.decode_u64(self.offset)
|
|
self.offset += 8
|
|
return ret
|
|
|
|
func get_f64() -> float:
|
|
var ret:float
|
|
ret = data.decode_double(self.offset)
|
|
self.offset += 8
|
|
return ret
|