From 620ae33593a69ff267bf77cdb3c938350ee520e4 Mon Sep 17 00:00:00 2001 From: cuu Date: Tue, 4 Dec 2018 13:18:50 +0800 Subject: [PATCH] fix code,sound,brightness,update --- .../10_Settings/Brightness/brightness_page.go | 17 +++++++++-------- Menu/GameShell/10_Settings/Sound/sound_page.go | 13 +++++++------ .../10_Settings/Update/plugin_init.go | 4 +++- .../10_Settings/Update/update_page.go | 18 ++++++++++-------- build.sh | 4 ++-- 5 files changed, 31 insertions(+), 25 deletions(-) diff --git a/Menu/GameShell/10_Settings/Brightness/brightness_page.go b/Menu/GameShell/10_Settings/Brightness/brightness_page.go index 8ef39cc..5712754 100644 --- a/Menu/GameShell/10_Settings/Brightness/brightness_page.go +++ b/Menu/GameShell/10_Settings/Brightness/brightness_page.go @@ -3,6 +3,7 @@ package main import( "fmt" + "io/ioutil" "strconv" "github.com/cuu/gogame/event" "github.com/cuu/LauncherGoDev/sysgo" @@ -17,22 +18,22 @@ type SliderIcon struct { } func NewSliderIcon() *SliderIcon { - p := &UI.SliderIcon{} - p.MyType = ICON_TYPES["EXE"] - p.Align = ALIGN["VCenter"] + p := &SliderIcon{} + p.MyType = UI.ICON_TYPES["EXE"] + p.Align = UI.ALIGN["VCenter"] return p } type SliderMultiIcon struct { UI.MultiIconItem - Parent *SoundSlider + Parent *BSlider } func NewSliderMultiIcon() *SliderMultiIcon { p := &SliderMultiIcon{} - p.MyType = ICON_TYPES["EXE"] - p.Align = ALIGN["VCenter"] + p.MyType = UI.ICON_TYPES["EXE"] + p.Align = UI.ALIGN["VCenter"] p.IconIndex = 0 p.IconWidth = 18 @@ -47,7 +48,7 @@ type BSlider struct { BGpng *SliderIcon BGwidth int BGheight int - NeedleSurf + //NeedleSurf Scale *SliderMultiIcon Parent *BrightnessPage @@ -56,7 +57,7 @@ type BSlider struct { } func NewBSlider() *BSlider { - p := &SoundSlider{} + p := &BSlider{} p.Range = [2]int{0,255} p.Value = 0 diff --git a/Menu/GameShell/10_Settings/Sound/sound_page.go b/Menu/GameShell/10_Settings/Sound/sound_page.go index d5176bc..ad79952 100644 --- a/Menu/GameShell/10_Settings/Sound/sound_page.go +++ b/Menu/GameShell/10_Settings/Sound/sound_page.go @@ -2,6 +2,7 @@ package main import( "fmt" + "github.com/veandco/go-sdl2/sdl" "github.com/cuu/gogame/event" "github.com/cuu/LauncherGoDev/sysgo/UI" ) @@ -15,8 +16,8 @@ type SliderIcon struct { } func NewSliderIcon() *SliderIcon { p := &SliderIcon{} - p.MyType = ICON_TYPES["EXE"] - p.Align = ALIGN["VCenter"] + p.MyType = UI.ICON_TYPES["EXE"] + p.Align = UI.ALIGN["VCenter"] return p } @@ -28,8 +29,8 @@ type SliderMultiIcon struct { func NewSliderMultiIcon() *SliderMultiIcon { p := &SliderMultiIcon{} - p.MyType = ICON_TYPES["EXE"] - p.Align = ALIGN["VCenter"] + p.MyType = UI.ICON_TYPES["EXE"] + p.Align = UI.ALIGN["VCenter"] p.IconIndex = 0 p.IconWidth = 18 @@ -44,7 +45,7 @@ type SoundSlider struct { BGpng *SliderIcon BGwidth int BGheight int - NeedleSurf + //NeedleSurf Scale *SliderMultiIcon Parent *SoundPage @@ -193,7 +194,7 @@ func (self *SoundPage) OnLoadCb() { } func (self *SoundPage) WhenSliderDrag(val int) { //value 0 - 100 - if value <0 || value > 100 { + if val <0 || val > 100 { return } diff --git a/Menu/GameShell/10_Settings/Update/plugin_init.go b/Menu/GameShell/10_Settings/Update/plugin_init.go index c95fac1..bce4467 100644 --- a/Menu/GameShell/10_Settings/Update/plugin_init.go +++ b/Menu/GameShell/10_Settings/Update/plugin_init.go @@ -1,5 +1,7 @@ package main - +import ( + "github.com/cuu/LauncherGoDev/sysgo/UI" +) /******************************************************************************/ type UpdatePlugin struct { UI.Plugin diff --git a/Menu/GameShell/10_Settings/Update/update_page.go b/Menu/GameShell/10_Settings/Update/update_page.go index 92fd20f..289ff60 100644 --- a/Menu/GameShell/10_Settings/Update/update_page.go +++ b/Menu/GameShell/10_Settings/Update/update_page.go @@ -12,10 +12,10 @@ import ( "github.com/cuu/gogame/time" // "github.com/cuu/gogame/surface" "github.com/cuu/gogame/event" - "github.com/cuu/gogame/rect" - "github.com/cuu/gogame/color" + //"github.com/cuu/gogame/rect" + //"github.com/cuu/gogame/color" // "github.com/cuu/gogame/font" - "github.com/cuu/gogame/draw" + //"github.com/cuu/gogame/draw" "github.com/cuu/LauncherGoDev/sysgo" "github.com/cuu/LauncherGoDev/sysgo/UI" @@ -40,18 +40,18 @@ func NewUpdateConfirmPage() *UpdateConfirmPage { p.FootMsg = [5]string{"Nav","","","Cancel","Yes"} p.ConfirmText = "Confirm Update?" - + return p } func (self *UpdateConfirmPage) KeyDown(ev *event.Event) { - if ev.Data["Key"] == CurKeys["A"] || ev.Data["Key"] == CurKeys["Menu"] { + if ev.Data["Key"] == UI.CurKeys["A"] || ev.Data["Key"] == UI.CurKeys["Menu"] { self.ReturnToUpLevelPage() self.Screen.Draw() self.Screen.SwapAndShow() } - if ev.Data["Key"] == CurKeys["B"] { + if ev.Data["Key"] == UI.CurKeys["B"] { if self.GIT == true { cmdpath := fmt.Sprintf("feh --bg-center %s/sys.go/gameshell/wallpaper/updating.png; cd %s ;git pull; git reset --hard %s ; feh --bg-center %s/sys.py/gameshell/wallpaper/loading.png ", launchergo_path, @@ -95,7 +95,7 @@ func NewUpdatePage() *UpdatePage { p.SelectedIconTopOffset = 20 p.EasingDur = 10 - p.Align = ALIGN["SLeft"] + p.Align = UI.ALIGN["SLeft"] p.ListFontObj = UI.Fonts["varela15"] return p @@ -249,6 +249,8 @@ func (self *UpdatePage) KeyDown(ev *event.Event) { func (self *UpdatePage) Draw() { self.ClearCanvas() - for + for _,v := range self.MyList { + v.Draw() + } } diff --git a/build.sh b/build.sh index 3f58a1f..f6779f3 100755 --- a/build.sh +++ b/build.sh @@ -21,11 +21,11 @@ go build -o wifi.so -buildmode=plugin cd - cd Menu/GameShell/10_Settings/Sound -go build --ldflags="-s -w" o sound.so -buildmode=plugin +go build -ldflags="-s -w" -o sound.so -buildmode=plugin cd - cd Menu/GameShell/10_Settings/Brightness -go build --ldflags="-s -w" o brightness.so -buildmode=plugin +go build -ldflags="-s -w" -o brightness.so -buildmode=plugin cd -