start to clone warehouse

This commit is contained in:
cuu
2021-10-20 01:34:36 +08:00
parent 21ae3d9358
commit 23b2f6caf8
12 changed files with 1102 additions and 3 deletions

View File

@@ -38,6 +38,7 @@ func (self *IconPool) Init() {
keyname := strings.Split(f.Name(), ".")
if len(keyname) > 1 {
self.Icons[keyname[0]] = image.Load(self.GameShellIconPath + "/" + f.Name())
}
}
}
@@ -48,8 +49,32 @@ func (self *IconPool) GetImgSurf(keyname string) *sdl.Surface {
if _, ok := self.Icons[keyname]; ok {
return self.Icons[keyname]
} else {
fmt.Println("IconPool GetImgSurf ", keyname, " failed")
return nil
icon_file := self.GameShellIconPath+"/"+keyname+".png"
if IsAFile(icon_file) {
self.Icons[keyname] = image.Load(icon_file)
return self.Icons[keyname]
}else {
fmt.Println("IconPool GetImgSurf ", keyname, " failed")
return nil
}
}
}
func (self *IconPool) Width(keyname string) int {
if _,ok := self.Icons[keyname]; ok {
return int(self.Icons[keyname].W)
}else {
fmt.Println("IconPool lookup ", keyname, " failed")
return 0
}
}
func (self *IconPool) Height(keyname string) int {
if _,ok := self.Icons[keyname]; ok {
return int(self.Icons[keyname].W)
}else {
fmt.Println("IconPool lookup ", keyname, " failed")
return 0
}
}