diff --git a/apgbpal.go b/apgbpal.go new file mode 100644 index 0000000..d3e9e28 --- /dev/null +++ b/apgbpal.go @@ -0,0 +1,58 @@ +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 { + +} \ No newline at end of file