hatmill/attribute/coords.go

28 lines
419 B
Go
Raw Permalink Normal View History

2019-05-30 04:41:04 +00:00
package attribute
import (
2019-08-31 18:46:32 +00:00
"bytes"
2019-05-30 04:41:04 +00:00
"git.codemonkeysoftware.net/b/hatmill"
2019-05-30 04:41:04 +00:00
)
2019-08-31 18:46:32 +00:00
type CoordsList []float32
func (l CoordsList) String() string {
var buf bytes.Buffer
for i, f := range l {
if i > 0 {
buf.WriteRune(',')
}
buf.WriteString(Float(f).String())
2019-05-30 04:41:04 +00:00
}
2019-08-31 18:46:32 +00:00
return buf.String()
}
func Coords(values ...float32) hatmill.Attrib {
2019-05-30 04:41:04 +00:00
return hatmill.Attrib{
Key: "coords",
2019-08-31 18:46:32 +00:00
Value: CoordsList(values),
2019-05-30 04:41:04 +00:00
}
}