diff --git a/main b/main index 2008909..bcc990f 100755 Binary files a/main and b/main differ diff --git a/skin/default/Menu/GameShell/20_Retro Games/MAME.png b/skin/default/Menu/GameShell/20_Retro Games/MAME.png new file mode 100644 index 0000000..9a859f5 Binary files /dev/null and b/skin/default/Menu/GameShell/20_Retro Games/MAME.png differ diff --git a/skin/default/Menu/GameShell/20_Retro Games/MGBA.png b/skin/default/Menu/GameShell/20_Retro Games/MGBA.png new file mode 100644 index 0000000..e8c575b Binary files /dev/null and b/skin/default/Menu/GameShell/20_Retro Games/MGBA.png differ diff --git a/skin/default/Menu/GameShell/20_Retro Games/NESTOPIA.png b/skin/default/Menu/GameShell/20_Retro Games/NESTOPIA.png new file mode 100644 index 0000000..57dbd7d Binary files /dev/null and b/skin/default/Menu/GameShell/20_Retro Games/NESTOPIA.png differ diff --git a/skin/default/Menu/GameShell/CaveStory.png b/skin/default/Menu/GameShell/CaveStory.png new file mode 100644 index 0000000..5faa2ee Binary files /dev/null and b/skin/default/Menu/GameShell/CaveStory.png differ diff --git a/skin/default/Menu/GameShell/Music Player.png b/skin/default/Menu/GameShell/Music Player.png new file mode 100644 index 0000000..1d397ad Binary files /dev/null and b/skin/default/Menu/GameShell/Music Player.png differ diff --git a/skin/default/Menu/GameShell/PowerOFF.png b/skin/default/Menu/GameShell/PowerOFF.png new file mode 100644 index 0000000..57ee7f9 Binary files /dev/null and b/skin/default/Menu/GameShell/PowerOFF.png differ diff --git a/skin/default/Menu/GameShell/Retro Games.png b/skin/default/Menu/GameShell/Retro Games.png new file mode 100644 index 0000000..2733820 Binary files /dev/null and b/skin/default/Menu/GameShell/Retro Games.png differ diff --git a/skin/default/Menu/GameShell/RetroArch.png b/skin/default/Menu/GameShell/RetroArch.png new file mode 100644 index 0000000..b7bd33e Binary files /dev/null and b/skin/default/Menu/GameShell/RetroArch.png differ diff --git a/skin/default/Menu/GameShell/Settings.png b/skin/default/Menu/GameShell/Settings.png new file mode 100644 index 0000000..3e194ac Binary files /dev/null and b/skin/default/Menu/GameShell/Settings.png differ diff --git a/skin/default/Menu/GameShell/Sleep.png b/skin/default/Menu/GameShell/Sleep.png new file mode 100644 index 0000000..b2d7dd1 Binary files /dev/null and b/skin/default/Menu/GameShell/Sleep.png differ diff --git a/skin/default/Menu/GameShell/TinyCloud.png b/skin/default/Menu/GameShell/TinyCloud.png new file mode 100644 index 0000000..9ba0dff Binary files /dev/null and b/skin/default/Menu/GameShell/TinyCloud.png differ diff --git a/skin/default/Menu/GameShell/freeDM.png b/skin/default/Menu/GameShell/freeDM.png new file mode 100644 index 0000000..bf4d479 Binary files /dev/null and b/skin/default/Menu/GameShell/freeDM.png differ diff --git a/sysgo/UI/foot_bar.go b/sysgo/UI/foot_bar.go index 9504989..133111c 100644 --- a/sysgo/UI/foot_bar.go +++ b/sysgo/UI/foot_bar.go @@ -19,15 +19,36 @@ import ( var FootBar_BarHeight = 20 type FootBarIconItem struct { - MultiIconItem + MultiIconItem Parent *FootBar } func NewFootBarIconItem() *FootBarIconItem { m := &FootBarIconItem{} + m.IconIndex = 0 + m.IconWidth = 18 + m.IconHeight = 18 + m.Align = ALIGN["VCenter"] + return m } +func (self *FootBarIconItem) Adjust(x,y,w,h,at int) { + self.PosX = x + self.PosY = y + self.Width = w + self.Height = h + self.AnimationTime = at + + if self.Label != nil { + self.Label.SetCanvasHWND(self.Parent.CanvasHWND) + } + + self.CreateImgSurf() +// self.AdjustLinkPage() + +} + func (self *FootBarIconItem) TotalWidth() int { lab_w,_ := self.Label.Size() return self.Width + lab_w @@ -48,7 +69,8 @@ func (self *FootBarIconItem) Draw() { if self.ImgSurf != nil { portion := rect.Rect(0, self.IconIndex*self.IconHeight, self.IconWidth, self.IconHeight) surface.Blit(self.Parent.CanvasHWND, self.ImgSurf, draw.MidRect(self.PosX,self.PosY, self.Width,self.Height, Width,Height),&portion) - + }else { + fmt.Println("self.ImgSurf is nil ") } } @@ -88,7 +110,7 @@ func NewFootBar() *FootBar { f.LabelFont = Fonts["veramono10"] f.State = "normal" - f.icon_base_path = SkinMap("gameshell/footbar_icons/") + f.icon_base_path = SkinMap("sysgo/gameshell/footbar_icons/") f.Icons = make(map[string]IconItemInterface) @@ -109,6 +131,8 @@ func (self *FootBar) ReadFootBarIcons( icondir string) { it.Parent = self it.ImgSurf = share_surf it.Align = ALIGN["HLeft"] // (X)Text + it.IconWidth = self.IconWidth + it.IconHeight =self.IconHeight it.AddLabel("game", self.LabelFont) it.Adjust( self.IconWidth/2+i*self.IconWidth, self.IconHeight/2+2, self.IconWidth,self.IconHeight,0) it.IconIndex = i @@ -122,6 +146,8 @@ func (self *FootBar) Init(main_screen *MainScreen) { self.HWND = main_screen.HWND self.SkinManager = main_screen.SkinManager + self.ReadFootBarIcons(self.icon_base_path) + round_corners := NewFootBarIconItem() round_corners.IconWidth = 10 round_corners.IconHeight = 10 @@ -196,6 +222,7 @@ func (self *FootBar) ClearCanvas() { func (self *FootBar) Draw() { self.ClearCanvas() + self.Icons["nav"].NewCoord(self.IconWidth/2+3, self.IconHeight/2+2) self.Icons["nav"].Draw() diff --git a/sysgo/UI/icon_item.go b/sysgo/UI/icon_item.go index 1036190..7367be4 100644 --- a/sysgo/UI/icon_item.go +++ b/sysgo/UI/icon_item.go @@ -1,6 +1,7 @@ package UI import ( + "fmt" "github.com/veandco/go-sdl2/sdl" "github.com/veandco/go-sdl2/ttf" @@ -185,9 +186,10 @@ func (self *IconItem) AddLabel(text string, fontobj *ttf.Font) { if self.Label == nil { l:= NewLabel() self.Label = l - }else { - self.Label.Init(text,fontobj,nil) - } + } + + self.Label.Init(text,fontobj,nil) + } func (self *IconItem) GetLinkPage() PageInterface { @@ -254,7 +256,10 @@ func (self *IconItem) Draw() { lab_w,lab_h:= self.Label.Size() if self.Align == ALIGN["VCenter"] { - self.Label.NewCoord( self.PosX - lab_w/2 + parent_x, self.PosY + lab_h/2+6+parent_y) + fmt.Println("IconItem Draw VCenter:",lab_w,lab_h,self.Label.GetText()) + + self.Label.NewCoord( self.PosX - lab_w/2 + parent_x, self.PosY + self.Height/2+6+parent_y) + }else if self.Align == ALIGN["HLeft"] { self.Label.NewCoord( self.PosX + self.Width/2+3+parent_x, self.PosY - lab_h/2 + parent_y) } diff --git a/sysgo/UI/icon_pool.go b/sysgo/UI/icon_pool.go index 1570c27..892def6 100644 --- a/sysgo/UI/icon_pool.go +++ b/sysgo/UI/icon_pool.go @@ -1,6 +1,7 @@ package UI import ( + "fmt" "io/ioutil" "log" "strings" @@ -18,7 +19,7 @@ type IconPool struct { func NewIconPool() *IconPool { i := &IconPool{} - i.GameShellIconPath = SkinMap("gameshell/icons/") + i.GameShellIconPath = SkinMap("sysgo/gameshell/icons/") i.Icons = make( map[string]*sdl.Surface ) return i } @@ -49,6 +50,7 @@ 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 } } diff --git a/sysgo/UI/main_screen.go b/sysgo/UI/main_screen.go index d4c41de..4205e3f 100644 --- a/sysgo/UI/main_screen.go +++ b/sysgo/UI/main_screen.go @@ -321,6 +321,7 @@ func (self *MainScreen) ReadTheDirIntoPages(_dir string, pglevel int, cur_page P if FileExists( SkinMap(_dir+"/"+i2+".png")) { iconitem.ImageName = SkinMap(_dir+"/"+i2+".png") }else { + fmt.Println( SkinMap(_dir+"/"+i2+".png") ) untitled := NewUntitledIcon() untitled.Init() if len(i2) > 1 { @@ -359,6 +360,7 @@ func (self *MainScreen) ReadTheDirIntoPages(_dir string, pglevel int, cur_page P if FileExists( SkinMap( _dir+"/"+ ReplaceSuffix(i2,"png"))) { iconitem.ImageName = SkinMap( _dir+"/"+ ReplaceSuffix(i2,"png")) }else { + untitled:= NewUntitledIcon() untitled.Init() if len(i2) > 1 { @@ -431,8 +433,7 @@ func (self *MainScreen) Draw() { } if self.FootBar != nil { - fmt.Println( len(self.CurrentPage.GetFootMsg())) -// self.FootBar.SetLabelTexts( self.CurrentPage.GetFootMsg()) -// self.FootBar.Draw() + self.FootBar.SetLabelTexts( self.CurrentPage.GetFootMsg()) + self.FootBar.Draw() } } diff --git a/sysgo/UI/multi_icon_item.go b/sysgo/UI/multi_icon_item.go index 390d470..8018b7a 100644 --- a/sysgo/UI/multi_icon_item.go +++ b/sysgo/UI/multi_icon_item.go @@ -24,7 +24,7 @@ func NewMultiIconItem() *MultiIconItem { return m } -func (self * MultiIconItem) CreateImageSurf() { +func (self * MultiIconItem) CreateImgSurf() { if self.ImgSurf == nil && self.ImageName != "" { self.ImgSurf = image.Load(self.ImageName) } diff --git a/sysgo/UI/page.go b/sysgo/UI/page.go index d623631..b415834 100644 --- a/sysgo/UI/page.go +++ b/sysgo/UI/page.go @@ -91,6 +91,8 @@ type PageSelector struct { func NewPageSelector() *PageSelector { p := &PageSelector{} + p.OnShow = true + return p } @@ -736,6 +738,7 @@ func (self *Page) ResetPageSelector() { func (self *Page) DrawPageSelector() { if self.Ps.GetOnShow() == true { + fmt.Println("DrawPageSelector") self.Ps.Draw() } } diff --git a/sysgo/UI/title_bar.go b/sysgo/UI/title_bar.go index f30929c..16c3180 100644 --- a/sysgo/UI/title_bar.go +++ b/sysgo/UI/title_bar.go @@ -16,7 +16,6 @@ import ( "github.com/cuu/gogame/rect" "github.com/cuu/gogame/font" "github.com/cuu/gogame/draw" - "github.com/itchyny/volume-go" "github.com/vjeantet/jodaTime" @@ -38,11 +37,30 @@ type TitleBarIconItem struct { func NewTitleBarIconItem() *TitleBarIconItem { m := &TitleBarIconItem{} - + m.IconIndex = 0 + m.IconWidth = 18 + m.IconHeight = 18 + m.Align = ALIGN["VCenter"] return m } +func (self *TitleBarIconItem) Adjust(x,y,w,h,at int) { + self.PosX = x + self.PosY = y + self.Width = w + self.Height = h + self.AnimationTime = at + + if self.Label != nil { + self.Label.SetCanvasHWND(self.Parent.CanvasHWND) + } + + self.CreateImgSurf() +// self.AdjustLinkPage() + +} + func (self *TitleBarIconItem) Draw() { parent_x,parent_y := self.Parent.PosX,self.Parent.PosY @@ -114,7 +132,7 @@ func NewTitleBar() *TitleBar { t.Icons = make(map[string]IconItemInterface) - t.icon_base_path = SkinMap("gameshell/titlebar_icons/") + t.icon_base_path = SkinMap("sysgo/gameshell/titlebar_icons/") t.TitleFont = Fonts["varela12"] t.TimeFont = Fonts["varela16"] @@ -344,6 +362,7 @@ func (self *TitleBar) Draw(title string) { if self.DBusManager.IsWifiConnectedNow() == true { ge := self.GetWifiStrength( self.DBusManager.WifiStrength() ) + fmt.Println("wifi ge: ",ge) if ge > 0 { self.Icons["wifistatus"].SetIconIndex(ge) self.Icons["wifistatus"].NewCoord(start_x+self.IconWidth+5, self.IconHeight/2+(self.BarHeight-self.IconHeight)/2 ) @@ -353,8 +372,11 @@ func (self *TitleBar) Draw(title string) { self.Icons["wifistatus"].Draw() } }else { + self.Icons["wifistatus"].SetIconIndex(0) + self.Icons["wifistatus"].NewCoord(start_x+self.IconWidth+5, self.IconHeight/2+(self.BarHeight-self.IconHeight)/2) + self.Icons["wifistatus"].Draw() } diff --git a/sysgo/UI/util_funcs.go b/sysgo/UI/util_funcs.go index 7c08cea..962b030 100644 --- a/sysgo/UI/util_funcs.go +++ b/sysgo/UI/util_funcs.go @@ -21,9 +21,9 @@ func SkinMap(orig_file_or_dir string) string { ret = strings.Replace(orig_file_or_dir,"..", skin_dir_prefix + DefaultSkin,-1) } }else { - ret = skin_dir_prefix+sysgo.SKIN+"/sysgo/"+orig_file_or_dir + ret = skin_dir_prefix+sysgo.SKIN+"/"+orig_file_or_dir if FileExists(ret) == false { - ret = skin_dir_prefix+DefaultSkin+"/sysgo/"+orig_file_or_dir + ret = skin_dir_prefix+DefaultSkin+"/"+orig_file_or_dir } }