Files
esdi/helpers/helper.go
T
esilva f2d92c80ee still working on the layout tool
- started doing it in a more adhoc way and will engineer it once I have
a clear vision
2026-02-12 23:03:57 +00:00

29 lines
382 B
Go

// Package helper
package helper
import (
"bytes"
"encoding/binary"
)
type Vector struct {
DX uint16
DY uint16
}
func B32(s string) [32]byte {
var b [32]byte
copy(b[:], s)
return b
}
func StructToBytes(s any) ([]byte, error) {
var buf bytes.Buffer
err := binary.Write(&buf, binary.LittleEndian, s)
if err != nil {
return []byte{}, err
}
return buf.Bytes(), nil
}