bluetooth alpha

This commit is contained in:
cuu
2018-12-18 19:14:00 +08:00
parent 78522c4b46
commit f4e4ff3921
6 changed files with 106 additions and 50 deletions

View File

@@ -250,6 +250,8 @@ func (self *FavListPage) ScrollUp() {
if y < 0 {
for i,_ := range self.MyList{
x,y = self.MyList[i].Coord()
_, h = self.MyList[i].Size()
self.MyList[i].NewCoord(x, y + h)
}
@@ -273,6 +275,8 @@ func (self *FavListPage) ScrollDown(){
_,h := cur_li.Size()
if y + h > self.Height {
for i,_ := range self.MyList{
x,y = self.MyList[i].Coord()
_, h = self.MyList[i].Size()
self.MyList[i].NewCoord(x,y-h)
}
self.Scrolled -=1

View File

@@ -227,6 +227,7 @@ func (self *EmulatorListItem) Draw() {
x,y := self.Labels["Text"].Coord()
_,h := self.Labels["Text"].Size()
if self.Path != "[..]" {
self.Labels["Text"].NewCoord(23,y)

View File

@@ -74,7 +74,7 @@ func (self *RomListPage) GeneratePathList(path string) ([]map[string]string,erro
if UI.IsDirectory(path) == false {
return nil,errors.New("Path is not a folder")
}
dirmap := make(map[string]string)
var ret []map[string]string
file_paths,err := filepath.Glob(path+"/*")//sorted
@@ -82,8 +82,9 @@ func (self *RomListPage) GeneratePathList(path string) ([]map[string]string,erro
fmt.Println(err)
return ret,err
}
for _,v := range file_paths {
dirmap := make(map[string]string)
if UI.IsDirectory(v) && self.EmulatorConfig.FILETYPE == "dir" { // like DOSBOX
gameshell_bat := self.EmulatorConfig.EXT[0]
if UI.GetGid(v) == FavGID { // skip fav roms
@@ -139,7 +140,7 @@ func (self *RomListPage) GeneratePathList(path string) ([]map[string]string,erro
func (self *RomListPage) SyncList( path string ) {
alist,err := self.GeneratePathList(path)
//fmt.Println(alist)
if err != nil {
fmt.Println(err)
return
@@ -191,7 +192,6 @@ func (self *RomListPage) SyncList( path string ) {
}
li.Init(init_val)
self.MyList = append(self.MyList,li)
}
}
@@ -276,6 +276,8 @@ func (self *RomListPage) ScrollUp() {
_,h := cur_li.Size()
if y < 0 {
for i,_ := range self.MyList{
x,y = self.MyList[i].Coord()
_, h = self.MyList[i].Size()
self.MyList[i].NewCoord(x,y + h)
}
@@ -300,6 +302,8 @@ func (self *RomListPage) ScrollDown(){
if y+ h > self.Height {
for i,_ := range self.MyList{
x,y = self.MyList[i].Coord()
_, h = self.MyList[i].Size()
self.MyList[i].NewCoord(x,y - h)
}
self.Scrolled -=1
@@ -538,28 +542,20 @@ func (self *RomListPage) Draw() {
}else{
_,h := self.Ps.Size()
if len(self.MyList) * HierListItemDefaultHeight > self.Height {
self.Ps.NewSize(self.Width - 10,h)
self.Ps.Draw()
for _,v := range self.MyList {
_,y := v.Coord()
if y > self.Height + self.Height/2 {
if y > (self.Height + self.Height/2) {
break
}
if y < 0 {
continue
}
v.Draw()
}
self.Scroller.UpdateSize( len(self.MyList)*HierListItemDefaultHeight, self.PsIndex*HierListItemDefaultHeight)
self.Scroller.Draw()
}else {
self.Ps.NewSize(self.Width,h)
self.Ps.Draw()