diff options
| author | Arda Serdar Pektezol <1669855+pektezol@users.noreply.github.com> | 2024-06-15 13:58:30 +0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-06-15 13:58:30 +0300 |
| commit | 77e4b066cb8d506b4bc944ab4eb2d6e4679e2202 (patch) | |
| tree | 1d549eca619ed36cb881e487cb054c4643ac8376 /pkg/messages/types/netTick.go | |
| parent | change project name to sdp.go (diff) | |
| download | sdp.go-77e4b066cb8d506b4bc944ab4eb2d6e4679e2202.tar.gz sdp.go-77e4b066cb8d506b4bc944ab4eb2d6e4679e2202.tar.bz2 sdp.go-77e4b066cb8d506b4bc944ab4eb2d6e4679e2202.zip | |
enable multithreading with goroutines (#20)
Diffstat (limited to 'pkg/messages/types/netTick.go')
| -rw-r--r-- | pkg/messages/types/netTick.go | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/pkg/messages/types/netTick.go b/pkg/messages/types/netTick.go index 9ef1ce2..0bcbc05 100644 --- a/pkg/messages/types/netTick.go +++ b/pkg/messages/types/netTick.go | |||
| @@ -2,23 +2,23 @@ package messages | |||
| 2 | 2 | ||
| 3 | import ( | 3 | import ( |
| 4 | "github.com/pektezol/bitreader" | 4 | "github.com/pektezol/bitreader" |
| 5 | "github.com/pektezol/sdp.go/pkg/writer" | 5 | "github.com/pektezol/sdp.go/pkg/types" |
| 6 | ) | 6 | ) |
| 7 | 7 | ||
| 8 | type NetTick struct { | 8 | type NetTick struct { |
| 9 | Tick uint32 | 9 | Tick uint32 `json:"tick"` |
| 10 | HostFrameTime float32 | 10 | HostFrameTime float32 `json:"host_frame_time"` |
| 11 | HostFrameTimeStdDeviation float32 | 11 | HostFrameTimeStdDeviation float32 `json:"host_frame_time_std_deviation"` |
| 12 | } | 12 | } |
| 13 | 13 | ||
| 14 | func ParseNetTick(reader *bitreader.Reader) NetTick { | 14 | func ParseNetTick(reader *bitreader.Reader, demo *types.Demo) NetTick { |
| 15 | netTick := NetTick{ | 15 | netTick := NetTick{ |
| 16 | Tick: reader.TryReadUInt32(), | 16 | Tick: reader.TryReadUInt32(), |
| 17 | HostFrameTime: float32(reader.TryReadUInt16()) / 1e5, | 17 | HostFrameTime: float32(reader.TryReadUInt16()) / 1e5, |
| 18 | HostFrameTimeStdDeviation: float32(reader.TryReadUInt16()) / 1e5, | 18 | HostFrameTimeStdDeviation: float32(reader.TryReadUInt16()) / 1e5, |
| 19 | } | 19 | } |
| 20 | writer.TempAppendLine("\t\tTick: %d", netTick.Tick) | 20 | demo.Writer.TempAppendLine("\t\tTick: %d", netTick.Tick) |
| 21 | writer.TempAppendLine("\t\tHost Frame Time: %f", netTick.HostFrameTime) | 21 | demo.Writer.TempAppendLine("\t\tHost Frame Time: %f", netTick.HostFrameTime) |
| 22 | writer.TempAppendLine("\t\tHost Frame Time Std Deviation: %f", netTick.HostFrameTimeStdDeviation) | 22 | demo.Writer.TempAppendLine("\t\tHost Frame Time Std Deviation: %f", netTick.HostFrameTimeStdDeviation) |
| 23 | return netTick | 23 | return netTick |
| 24 | } | 24 | } |