From ca90ebdfa8789654766c5d7969baa7afacd9ebd2 Mon Sep 17 00:00:00 2001 From: BanceDev Date: Mon, 16 Feb 2026 16:31:54 -0500 Subject: initial commit --- demo/qwd/data.go | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 demo/qwd/data.go (limited to 'demo/qwd/data.go') diff --git a/demo/qwd/data.go b/demo/qwd/data.go new file mode 100644 index 0000000..cc00c23 --- /dev/null +++ b/demo/qwd/data.go @@ -0,0 +1,32 @@ +package qwd + +import ( + "github.com/osm/quake/common/buffer" + "github.com/osm/quake/protocol" +) + +type Data struct { + Timestamp float32 + Command byte + Cmd *Cmd + Read *Read + Set *Set +} + +func (d *Data) Bytes() []byte { + buf := buffer.New() + + buf.PutFloat32(d.Timestamp) + buf.PutByte(d.Command) + + switch d.Command { + case protocol.DemoCmd: + buf.PutBytes(d.Cmd.Bytes()) + case protocol.DemoRead: + buf.PutBytes(d.Read.Bytes()) + case protocol.DemoSet: + buf.PutBytes(d.Set.Bytes()) + } + + return buf.Bytes() +} -- cgit v1.2.3-59-g8ed1b