apgbpal/apgbpal.go

58 lines
785 B
Go

package main
type RGBA struct {
R byte
G byte
B byte
A byte
}
func (c RGBA) Bytes() [4]byte {
return [4]byte {c.R, c.G, cB, c.A}
}
type BGPal [4]RGBA
func (b BGPal) Bytes() [20]byte {
var ret [20]byte
ret[0] = 'b'
ret[1] = 'g'
ret[2] = ':'
for c := 0; c < 4; c++ {
bb := b[c].Bytes()
for i := 0; i < 4; i++ {
ret[3+i+4*c]=bb[i]
}
}
ret[19] = '\n'
return ret
}
type OBJPal [3]RGBA
func (o OBJPal) Bytes(indexchar byte) [18]byte {
var ret [18]byte
ret[0] = 'o'
ret[1] = 'b'
ret[2] = 'j'
ret[3] = indexchar
ret[4] = ':'
for c := 0; c < 3; c++ {
oo := o[c].Bytes()
for i := 0; i < 4; i++ {
ret[5+i+4*c]=oo[i]
}
}
ret[17] = '\n'
return ret
}
type APGBPal struct {
BG BGPal
OBJ1 OBJPal
OBJ2 OBJPal
}
func (a APGBPal) Bytes() [56]byte {
}