bug fix,music player fix

This commit is contained in:
cuu
2023-01-22 08:33:10 +00:00
parent e59d572610
commit 057bcc86f1
8 changed files with 103 additions and 16 deletions

View File

@@ -54,7 +54,11 @@ func (stk *FolderStack) Last() string {
return stk.head.data.(string)
}
}
func (stk *FolderStack) Clear() {
for stk.Length() > 0 {
stk.Pop()
}
}
func NewFolderStack() *FolderStack {
stk := new(FolderStack)
stk.lock = &sync.Mutex{}

View File

@@ -70,6 +70,15 @@ func IsKeyStartOrA(key string) bool {
return key == CurKeys["Start"] || key == CurKeys["A"]
}
func IsKeyStartOrB(key string) bool {
return key == CurKeys["Start"] || key == CurKeys["B"]
}
func IsKeyMenuOrB(key string) bool {
return key == CurKeys["Menu"] || key == CurKeys["B"]
}
func IsKeyMenuOrA(key string) bool {
return key == CurKeys["Menu"] || key == CurKeys["A"]
}

View File

@@ -411,7 +411,18 @@ func (self *MainScreen) KeyDown(ev *event.Event) {
self.LastKey = ev.Data["Key"]
}
func (self *MainScreen) ShowMsg(content string, blocktime int) {
self.MsgBox.SetText(content)
self.MsgBox.Draw()
self.SwapAndShow()
if blocktime > 0 {
time.BlockDelay(blocktime)
self.CurrentPage.Draw()
self.SwapAndShow()
}
}
func (self *MainScreen) DrawRun() {
self.MsgBox.SetText("Launching....")
self.MsgBox.Draw()

View File

@@ -132,7 +132,7 @@ func NewTitleBar() *TitleBar {
t.icon_base_path = SkinMap("sysgo/gameshell/titlebar_icons/")
t.TitleFont = Fonts["varela16"]
t.TitleFont = Fonts["notosanscjk15"]
t.TimeFont = Fonts["varela12"]
t.InLowBackLight = -1
@@ -293,15 +293,15 @@ func (self *TitleBar) SetSoundVolume(vol int) {
func (self *TitleBar) CheckBatteryStat() {
bat_segs := [][]int{[]int{0, 6}, []int{7, 15}, []int{16, 20}, []int{21, 30}, []int{31, 50}, []int{51, 60}, []int{61, 80}, []int{81, 90}, []int{91, 100}}
self.Icons["battery"] = self.Icons["battery_unknown"]
if FileExists(sysgo.Battery) == false {
self.Icons["battery"] = self.Icons["battery_unknown"]
return
}
file, err := os.Open(sysgo.Battery)
if err != nil {
fmt.Println("Could not open file ", sysgo.Battery)
self.Icons["battery"] = self.Icons["battery_unknown"]
return
}
@@ -520,7 +520,7 @@ func (self *TitleBar) GetLocalTime() gotime.Time {
func (self *TitleBar) Draw(title string) {
self.ClearCanvas()
self.Title = title
cur_time := jodaTime.Format("HH:mm", self.GetLocalTime())
time_text_w, time_text_h := font.Size(self.TimeFont, cur_time)
@@ -529,12 +529,10 @@ func (self *TitleBar) Draw(title string) {
title_text_surf := font.Render(self.TitleFont, self.Title, true, self.SkinManager.GiveColor("Text"), nil)
surface.Blit(self.CanvasHWND, title_text_surf, draw.MidRect(title_text_w/2+self.LOffset, title_text_h/2+(self.BarHeight-title_text_h)/2, title_text_w, title_text_h, Width, Height), nil)
title_text_surf.Free()
time_text_surf := font.Render(self.TimeFont, cur_time, true, self.SkinManager.GiveColor("Text"), nil)
surface.Blit(self.CanvasHWND, time_text_surf, draw.MidRect(Width-time_text_w/2-self.ROffset, time_text_h/2+(self.BarHeight-time_text_h)/2, time_text_w, time_text_h, Width, Height), nil)
time_text_surf.Free()
start_x := Width - time_text_w - self.ROffset - self.IconWidth*3 // close to the time_text
@@ -574,4 +572,7 @@ func (self *TitleBar) Draw(title string) {
rect_ := rect.Rect(self.PosX, self.PosY, self.Width, self.Height)
surface.Blit(self.HWND, self.CanvasHWND, &rect_, nil)
}
title_text_surf.Free()
time_text_surf.Free()
}