data structure first draft, incomplete

This commit is contained in:
Kistaro Windrider 2023-12-09 20:25:04 -08:00
parent 8ff65697ff
commit 44ac333501
Signed by: kistaro
SSH Key Fingerprint: SHA256:TBE2ynfmJqsAf0CP6gsflA0q5X5wD5fVKWPsZ7eVUg8

58
apgbpal.go Normal file
View File

@ -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 {
}