Update and fix certain routines

pull/3/head
Minizbot2012 4 years ago
parent 262bf344ec
commit 2b41478166
No known key found for this signature in database
GPG Key ID: 977C8ADE12361917

@ -2,6 +2,7 @@ package orbweaver
import (
"encoding/binary"
"fmt"
"fyne.io/fyne"
"github.com/minizbot2012/orbbind/keys"
@ -16,20 +17,18 @@ type PKM struct {
//SaveIntoKeymap saves an orb
func SaveIntoKeymap(mapped *PKM, file fyne.FileWriteCloser) {
buf := make([]byte, 2)
for i := 0; i < 26; i++ {
if i < 26 {
buf := make([]byte, 2)
if i < 20 {
binary.LittleEndian.PutUint16(buf, uint16(keys.GetSCForASCII(int(byte(mapped.MIP[i])))))
} else {
binary.LittleEndian.PutUint16(buf, uint16(keys.GetSCForASCII(int(byte(mapped.SIP[i-20])))))
}
file.Write(buf)
if i < 20 {
binary.LittleEndian.PutUint16(buf, uint16(keys.GetSCForASCII(int(byte(mapped.MIP[i])))))
} else {
arr := []byte{byte(mapped.COL[0]), byte(mapped.COL[1]), byte(mapped.COL[2])}
file.Write(arr)
binary.LittleEndian.PutUint16(buf, uint16(keys.GetSCForASCII(int(byte(mapped.SIP[i-20])))))
}
fmt.Println(i, buf)
file.Write(buf)
}
arr := []byte{byte(mapped.COL[0]), byte(mapped.COL[1]), byte(mapped.COL[2])}
file.Write(arr)
file.Close()
}

Loading…
Cancel
Save