From 44ac33350131c2d5ddb1b6515520083a1d254112 Mon Sep 17 00:00:00 2001 From: Kistaro Windrider Date: Sat, 9 Dec 2023 20:25:04 -0800 Subject: [PATCH] data structure first draft, incomplete --- apgbpal.go | 58 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 apgbpal.go 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