remove all init() in UI, move into UI.Init()

This commit is contained in:
cuu 2019-01-07 22:09:53 +08:00
parent 003bb8f598
commit 4736ab131d
4 changed files with 20 additions and 8 deletions

View File

@ -269,7 +269,6 @@ func run() int {
screen := display.SetMode(int32(UI.Width),int32(UI.Height),0,32)
UI.Init()
UI.MyIconPool.Init()
PreparationInAdv()
@ -448,7 +447,9 @@ func run() int {
func main() {
var exitcode int
runtime.GOMAXPROCS(1)
os.Setenv("SDL_VIDEO_CENTERED","1")
sdl.Main(func() {

View File

@ -79,11 +79,14 @@ func Init() {
keyname := fmt.Sprintf("notosanscjk%d",i)
Fonts[keyname] = font.Font(fonts_path["notocjk"],i)
}
}
func init() {
//
keys_def_init()
//// global variables Init
if MyIconPool == nil {
MyIconPool = NewIconPool()
MyIconPool.Init()
}
if MyLangManager == nil {
@ -94,5 +97,7 @@ func init() {
if MySkinManager == nil {
MySkinManager = NewSkinManager()
MySkinManager.Init()
}
}
}

View File

@ -54,7 +54,8 @@ func DefineGameShell() {
}
func init(){
func keys_def_init(){
GameShell = make(map[string]string)
PC = make(map[string]string)

View File

@ -218,6 +218,7 @@ func CheckBattery() int {
if FileExists(sysgo.Battery) == false {
return -1
}
batinfos,err := ReadLines(sysgo.Battery)
if err == nil {
for _,v := range batinfos {
@ -236,9 +237,13 @@ func CheckBattery() int {
}else{
fmt.Println(err)
}
return 0
return 0
}
func System(cmd string) string {
ret := ""
out,err := exec.Command("bash","-c",cmd).Output()