diff --git a/Menu/GameShell/10_Settings/Brightness/brightness_page.go b/Menu/GameShell/10_Settings/Brightness/brightness_page.go index 5712754..f597edd 100644 --- a/Menu/GameShell/10_Settings/Brightness/brightness_page.go +++ b/Menu/GameShell/10_Settings/Brightness/brightness_page.go @@ -5,7 +5,14 @@ import( "io/ioutil" "strconv" + + "github.com/veandco/go-sdl2/sdl" + "github.com/cuu/gogame/event" + "github.com/cuu/gogame/draw" + "github.com/cuu/gogame/surface" + "github.com/cuu/gogame/rect" + "github.com/cuu/LauncherGoDev/sysgo" "github.com/cuu/LauncherGoDev/sysgo/UI" ) @@ -25,6 +32,35 @@ func NewSliderIcon() *SliderIcon { return p } +func (self *SliderIcon) Draw() { + if self.Parent == nil { + fmt.Println("Error: SliderIcon Draw Parent nil") + return + } + parent_x,parent_y := self.Parent.Coord() + + if self.Label != nil { +// lab_x,lab_y := self.Label.Coord() + lab_w,lab_h:= self.Label.Size() + + if self.Align == UI.ALIGN["VCenter"] { +// 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 == UI.ALIGN["HLeft"] { + self.Label.NewCoord( self.PosX + self.Width/2+3+parent_x, self.PosY - lab_h/2 + parent_y) + } + + self.Label.Draw() + } + + if self.ImgSurf != nil { + surface.Blit(self.Parent.GetCanvasHWND(), self.ImgSurf,draw.MidRect(self.PosX + parent_x, self.PosY + parent_y, + self.Width,self.Height, UI.Width, UI.Height),nil) + } +} + type SliderMultiIcon struct { UI.MultiIconItem Parent *BSlider @@ -42,6 +78,35 @@ func NewSliderMultiIcon() *SliderMultiIcon { return p } +func (self *SliderMultiIcon) Draw() { + if self.Parent == nil { + fmt.Println("Error: SliderMultiIcon Draw Parent nil") + return + } + parent_x,parent_y := self.Parent.Coord() + + if self.Label != nil { +// lab_x,lab_y := self.Label.Coord() + lab_w,lab_h:= self.Label.Size() + if self.Align == UI.ALIGN["VCenter"] { + self.Label.NewCoord( self.PosX - lab_w/2 + parent_x, self.PosY + self.Height/2+6 + parent_y) + }else if self.Align == UI.ALIGN["HLeft"] { + self.Label.NewCoord( self.PosX + self.Width/2+3 + parent_x, self.PosY - lab_h/2 + parent_y ) + } + + self.Label.Draw() + } + + if self.ImgSurf != nil { + + portion := rect.Rect(0,self.IconIndex*self.IconHeight,self.IconWidth,self.IconHeight) + + surface.Blit(self.Parent.GetCanvasHWND(), + self.ImgSurf,draw.MidRect(self.PosX + parent_x, self.PosY + parent_y, + self.Width,self.Height, UI.Width, UI.Height),&portion) + } +} + type BSlider struct { UI.Slider @@ -67,6 +132,10 @@ func NewBSlider() *BSlider { return p } +func (self *BSlider) GetCanvasHWND() *sdl.Surface { + return self.CanvasHWND +} + func (self *BSlider) Init() { self.Width = self.Parent.Width diff --git a/Menu/GameShell/10_Settings/Sound/sound_page.go b/Menu/GameShell/10_Settings/Sound/sound_page.go index ad79952..00abce7 100644 --- a/Menu/GameShell/10_Settings/Sound/sound_page.go +++ b/Menu/GameShell/10_Settings/Sound/sound_page.go @@ -4,6 +4,11 @@ import( "fmt" "github.com/veandco/go-sdl2/sdl" "github.com/cuu/gogame/event" + + "github.com/cuu/gogame/surface" + "github.com/cuu/gogame/draw" + "github.com/cuu/gogame/rect" + "github.com/cuu/LauncherGoDev/sysgo/UI" ) @@ -14,6 +19,7 @@ type SliderIcon struct { Parent *SoundSlider } + func NewSliderIcon() *SliderIcon { p := &SliderIcon{} p.MyType = UI.ICON_TYPES["EXE"] @@ -22,6 +28,36 @@ func NewSliderIcon() *SliderIcon { return p } +func (self *SliderIcon) Draw() { + if self.Parent == nil { + fmt.Println("Error: SliderIcon Draw Parent nil") + return + } + parent_x,parent_y := self.Parent.Coord() + + if self.Label != nil { +// lab_x,lab_y := self.Label.Coord() + lab_w,lab_h:= self.Label.Size() + + if self.Align == UI.ALIGN["VCenter"] { +// 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 == UI.ALIGN["HLeft"] { + self.Label.NewCoord( self.PosX + self.Width/2+3+parent_x, self.PosY - lab_h/2 + parent_y) + } + + self.Label.Draw() + } + + if self.ImgSurf != nil { + surface.Blit(self.Parent.GetCanvasHWND(), self.ImgSurf,draw.MidRect(self.PosX + parent_x, self.PosY + parent_y, + self.Width,self.Height, UI.Width, UI.Height),nil) + } +} + + type SliderMultiIcon struct { UI.MultiIconItem Parent *SoundSlider @@ -39,6 +75,35 @@ func NewSliderMultiIcon() *SliderMultiIcon { return p } +func (self *SliderMultiIcon) Draw() { + if self.Parent == nil { + fmt.Println("Error: SliderMultiIcon Draw Parent nil") + return + } + parent_x,parent_y := self.Parent.Coord() + + if self.Label != nil { +// lab_x,lab_y := self.Label.Coord() + lab_w,lab_h:= self.Label.Size() + if self.Align == UI.ALIGN["VCenter"] { + self.Label.NewCoord( self.PosX - lab_w/2 + parent_x, self.PosY + self.Height/2+6 + parent_y) + }else if self.Align == UI.ALIGN["HLeft"] { + self.Label.NewCoord( self.PosX + self.Width/2+3 + parent_x, self.PosY - lab_h/2 + parent_y ) + } + + self.Label.Draw() + } + + if self.ImgSurf != nil { + + portion := rect.Rect(0,self.IconIndex*self.IconHeight,self.IconWidth,self.IconHeight) + + surface.Blit(self.Parent.GetCanvasHWND(), + self.ImgSurf,draw.MidRect(self.PosX + parent_x, self.PosY + parent_y, + self.Width,self.Height, UI.Width, UI.Height),&portion) + } +} + type SoundSlider struct { UI.Slider @@ -131,6 +196,7 @@ func (self *SoundSlider) StepBack() { func (self *SoundSlider) Draw() { self.BGpng.NewCoord(self.Width/2,self.Height/2) + fmt.Printf("%x\n",self.BGpng.Parent) self.BGpng.Draw() self.Scale.NewCoord(self.Width/2,self.Height/2) diff --git a/Menu/GameShell/10_Settings/Update/update_page.go b/Menu/GameShell/10_Settings/Update/update_page.go index 289ff60..d4c1ec5 100644 --- a/Menu/GameShell/10_Settings/Update/update_page.go +++ b/Menu/GameShell/10_Settings/Update/update_page.go @@ -98,6 +98,8 @@ func NewUpdatePage() *UpdatePage { p.Align = UI.ALIGN["SLeft"] p.ListFontObj = UI.Fonts["varela15"] + p.AList = make( map[string]map[string]string ) + return p } @@ -124,7 +126,10 @@ func (self *UpdatePage) GenList() { li.Init(self.AList[k]["key"] ) } - li.Flag = self.AList[k]["value"] + li.Flag = self.AList[k]["key"] + + li.SetSmallText( self.AList[k]["value"]) + self.MyList = append(self.MyList,li) i+=1 diff --git a/sysgo/UI/icon_item.go b/sysgo/UI/icon_item.go index 0b127a8..9a8222a 100644 --- a/sysgo/UI/icon_item.go +++ b/sysgo/UI/icon_item.go @@ -1,7 +1,7 @@ package UI import ( -// "fmt" + "fmt" "github.com/veandco/go-sdl2/sdl" "github.com/veandco/go-sdl2/ttf" @@ -241,7 +241,10 @@ func (self *IconItem) GetCmdInvoke() PluginInterface { } func (self *IconItem) Draw() { - + if self.Parent == nil { + fmt.Println("Error: IconItem Draw Parent nil") + return + } parent_x,parent_y := self.Parent.Coord() if self.Label != nil { diff --git a/sysgo/UI/multi_icon_item.go b/sysgo/UI/multi_icon_item.go index 8018b7a..dab4946 100644 --- a/sysgo/UI/multi_icon_item.go +++ b/sysgo/UI/multi_icon_item.go @@ -1,6 +1,7 @@ package UI import ( + "fmt" "github.com/cuu/gogame/surface" "github.com/cuu/gogame/image" "github.com/cuu/gogame/draw" @@ -31,6 +32,10 @@ func (self * MultiIconItem) CreateImgSurf() { } func (self *MultiIconItem) Draw() { + if self.Parent == nil { + fmt.Println("Error: MultiIconItem Draw Parent nil") + return + } parent_x,parent_y := self.Parent.Coord() if self.Label != nil {