This commit is contained in:
cuu 2023-01-18 13:59:49 +00:00
parent 529f1d1b83
commit 2d18c23e89
2 changed files with 14 additions and 9 deletions

View File

@ -2,6 +2,7 @@ package MusicPlayer
import ( import (
"fmt" "fmt"
"path/filepath"
"log" "log"
"github.com/cuu/gogame/event" "github.com/cuu/gogame/event"
"github.com/cuu/gogame/rect" "github.com/cuu/gogame/rect"
@ -128,8 +129,8 @@ func (self *MusicPlayerPage) SyncList() {
li.Init("NoName") li.Init("NoName")
} }
} }
x,_ := li.Labels["Text"].Coord()
li.Labels["Text"].PosX = 7 li.Labels["Text"].NewCoord(x,7)
self.MyList = append(self.MyList, li) self.MyList = append(self.MyList, li)
} }
@ -143,7 +144,10 @@ func (self *MusicPlayerPage) SyncPlaying() {
self.MyList[i].(*MusicPlayPageListItem).Active = false self.MyList[i].(*MusicPlayPageListItem).Active = false
self.MyList[i].(*MusicPlayPageListItem).PlayingProcess = 0 self.MyList[i].(*MusicPlayPageListItem).PlayingProcess = 0
} }
current_song,_ := conn.CurrentSong()
if len(current_song) > 0 {
}
} }
func (self *MusicPlayerPage) Init() { func (self *MusicPlayerPage) Init() {

View File

@ -12,7 +12,7 @@ import (
//"github.com/clockworkpi/LauncherGoDev/sysgo" //"github.com/clockworkpi/LauncherGoDev/sysgo"
"github.com/clockworkpi/LauncherGoDev/sysgo/UI" "github.com/clockworkpi/LauncherGoDev/sysgo/UI"
"github.com/cuu/gogame/color" //"github.com/cuu/gogame/color"
"github.com/cuu/gogame/draw" "github.com/cuu/gogame/draw"
//"github.com/cuu/gogame/event" //"github.com/cuu/gogame/event"
//"github.com/cuu/gogame/rect" //"github.com/cuu/gogame/rect"
@ -46,26 +46,27 @@ func NewMusicPlayPageListItem() *MusicPlayPageListItem {
func (self *MusicPlayPageListItem) Draw() { func (self *MusicPlayPageListItem) Draw() {
x, _ := self.Labels["Text"].Coord() x, _ := self.Labels["Text"].Coord()
w, h := self.Labels["Text"].Size() _, h := self.Labels["Text"].Size()
self.Labels["Text"].NewCoord(x, self.PosY+(self.Height-h)/2) self.Labels["Text"].NewCoord(x, self.PosY+(self.Height-h)/2)
if self.MyType == UI.ICON_TYPES["DIR"] && self.Path != "[..]" { if self.MyType == UI.ICON_TYPES["DIR"] && self.Path != "[..]" {
sys_icon := self.Parent.(*MusicPlayerPage).Icons["sys"] sys_icon := self.Parent.(*MusicPlayerPage).Icons["sys"]
sys_icon.IconIndex = 0. _,h := sys_icon.Size()
sys_icon.NewCoord(self.PosX+12,self.PosY + ( self.Height - sys_icon.Height)/2 + sys_icon.Height /2) sys_icon.SetIconIndex(0)
sys_icon.NewCoord(self.PosX+12,self.PosY + ( self.Height - h)/2 + h/2)
sys_icon.Draw() sys_icon.Draw()
} }
if self.MyType == UI.ICON_TYPES["FILE"] { if self.MyType == UI.ICON_TYPES["FILE"] {
sys_icon := self.Parent.(*MusicPlayerPage).Icons["sys"] sys_icon := self.Parent.(*MusicPlayerPage).Icons["sys"]
sys_icon.IconIndex = 1 _,h := sys_icon.Size()
sys_icon.NewCoord(self.PosX+12,self.PosY + ( self.Height - sys_icon.Height)/2 + sys_icon.Height /2) sys_icon.SetIconIndex(1)
sys_icon.NewCoord(self.PosX+12,self.PosY + ( self.Height - h)/2 + h /2)
sys_icon.Draw() sys_icon.Draw()
} }
self.Labels["Text"].Active = self.Active
self.Labels["Text"].NewCoord(x, self.PosY+(self.Height-h)/2) self.Labels["Text"].NewCoord(x, self.PosY+(self.Height-h)/2)