go fmt ./...

This commit is contained in:
cuu
2021-10-11 13:55:54 +08:00
parent 0fe6399441
commit 7382cc40b1
88 changed files with 10028 additions and 10478 deletions

View File

@@ -5,41 +5,39 @@ import (
"io/ioutil"
"log"
"strings"
"github.com/veandco/go-sdl2/sdl"
"github.com/cuu/gogame/image"
)
type IconPool struct {
GameShellIconPath string
Icons map[string]*sdl.Surface
GameShellIconPath string
Icons map[string]*sdl.Surface
}
func NewIconPool() *IconPool {
i := &IconPool{}
i.GameShellIconPath = SkinMap("sysgo/gameshell/icons/")
i.Icons = make( map[string]*sdl.Surface )
i.Icons = make(map[string]*sdl.Surface)
return i
}
func (self *IconPool) Init() {
files,err := ioutil.ReadDir(self.GameShellIconPath)
files, err := ioutil.ReadDir(self.GameShellIconPath)
if err != nil {
log.Fatal(err)
return
}
for _,f := range files {
for _, f := range files {
if f.IsDir() {
//pass
}else {
if strings.HasSuffix(f.Name(),".png") == true {
keyname := strings.Split(f.Name(),".")
} else {
if strings.HasSuffix(f.Name(), ".png") == true {
keyname := strings.Split(f.Name(), ".")
if len(keyname) > 1 {
self.Icons[ keyname[0] ] = image.Load( self.GameShellIconPath+ "/"+f.Name() )
self.Icons[keyname[0]] = image.Load(self.GameShellIconPath + "/" + f.Name())
}
}
}
@@ -47,7 +45,7 @@ func (self *IconPool) Init() {
}
func (self *IconPool) GetImgSurf(keyname string) *sdl.Surface {
if _,ok := self.Icons[keyname]; ok {
if _, ok := self.Icons[keyname]; ok {
return self.Icons[keyname]
} else {
fmt.Println("IconPool GetImgSurf ", keyname, " failed")
@@ -56,5 +54,5 @@ func (self *IconPool) GetImgSurf(keyname string) *sdl.Surface {
}
var MyIconPool *IconPool
// = NewIconPool()
// = NewIconPool()