go fmt
This commit is contained in:
parent
3bd611feab
commit
8bf78d1cc6
20
apgbpal.go
20
apgbpal.go
@ -2,9 +2,9 @@ package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
"log"
|
||||
"os"
|
||||
"strings"
|
||||
)
|
||||
|
||||
type RGBA struct {
|
||||
@ -15,11 +15,11 @@ type RGBA struct {
|
||||
}
|
||||
|
||||
func (c RGBA) Bytes() [4]byte {
|
||||
return [4]byte {c.R, c.G, cB, c.A}
|
||||
return [4]byte{c.R, c.G, cB, c.A}
|
||||
}
|
||||
|
||||
func HexByteAt(str string, index int) (byte, error) {
|
||||
if len(string) < index + 2 {
|
||||
if len(string) < index+2 {
|
||||
return 0, fmt.Errorf("no hex byte at %d in too short string %q", index, str)
|
||||
}
|
||||
big, err := strconv.ParseUint(str[index:index+1], 16, 8)
|
||||
@ -67,7 +67,7 @@ func (b BGPal) Bytes() [20]byte {
|
||||
for c := 0; c < 4; c++ {
|
||||
bb := b[c].Bytes()
|
||||
for i := 0; i < 4; i++ {
|
||||
ret[3+i+4*c]=bb[i]
|
||||
ret[3+i+4*c] = bb[i]
|
||||
}
|
||||
}
|
||||
ret[19] = '\n'
|
||||
@ -100,7 +100,7 @@ func (o OBJPal) Bytes(indexchar byte) [18]byte {
|
||||
for c := 0; c < 3; c++ {
|
||||
oo := o[c].Bytes()
|
||||
for i := 0; i < 4; i++ {
|
||||
ret[5+i+4*c]=oo[i]
|
||||
ret[5+i+4*c] = oo[i]
|
||||
}
|
||||
}
|
||||
ret[17] = '\n'
|
||||
@ -113,7 +113,7 @@ func MustParseOBJPal(strs []string) OBJPal {
|
||||
strs = strs[1:]
|
||||
}
|
||||
if len(strs) != 3 {
|
||||
log.Fatalf("MustParseObjPal requires length 3, got %d", len(strs))
|
||||
log.Fatalf("MustParseObjPal requires length 3, got %d", len(strs))
|
||||
}
|
||||
var ret OBJPal
|
||||
for i := 0; i < 3; i++ {
|
||||
@ -126,7 +126,7 @@ func MustParseOBJPal(strs []string) OBJPal {
|
||||
}
|
||||
|
||||
type APGBPal struct {
|
||||
BG BGPal
|
||||
BG BGPal
|
||||
OBJ0 OBJPal
|
||||
OBJ1 OBJPal
|
||||
}
|
||||
@ -150,8 +150,8 @@ func main() {
|
||||
if err != nil {
|
||||
log.Fatalf("can't create test.pal: %v", err)
|
||||
}
|
||||
aUpPal := APGBPal {
|
||||
BG: MustParseBGPal([]string{"ffffff", "ff8484", "943a3a", "000000"}),
|
||||
aUpPal := APGBPal{
|
||||
BG: MustParseBGPal([]string{"ffffff", "ff8484", "943a3a", "000000"}),
|
||||
OBJ0: MustParseObjPal([]string{"7bff31", "008400", "000000"}),
|
||||
OBJ1: MustParseObjPal([]string{"63a5ff", "0000ff", "000000"}),
|
||||
}
|
||||
@ -164,4 +164,4 @@ func main() {
|
||||
}
|
||||
f.Close()
|
||||
os.Exit(0)
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user