go fmt ./...

This commit is contained in:
cuu
2021-10-11 13:55:54 +08:00
parent 0fe6399441
commit 7382cc40b1
88 changed files with 10028 additions and 10478 deletions

View File

@@ -4,19 +4,17 @@ import (
"fmt" "fmt"
"strconv" "strconv"
"strings"
"os/exec" "os/exec"
"strings"
"github.com/veandco/go-sdl2/ttf" "github.com/veandco/go-sdl2/ttf"
"github.com/cuu/gogame/surface" "github.com/cuu/gogame/color"
"github.com/cuu/gogame/event" "github.com/cuu/gogame/event"
"github.com/cuu/gogame/rect" "github.com/cuu/gogame/rect"
"github.com/cuu/gogame/color" "github.com/cuu/gogame/surface"
"github.com/clockworkpi/LauncherGoDev/sysgo/UI" "github.com/clockworkpi/LauncherGoDev/sysgo/UI"
) )
type InfoPageListItem struct { type InfoPageListItem struct {
@@ -79,7 +77,6 @@ func (self *InfoPageListItem) Draw() {
} }
type AboutPage struct { type AboutPage struct {
UI.Page UI.Page
AList map[string]map[string]string AList map[string]map[string]string
@@ -135,7 +132,6 @@ func (self *AboutPage) Uname() {
self.AList["uname"] = out self.AList["uname"] = out
} }
func (self *AboutPage) CpuMhz() { func (self *AboutPage) CpuMhz() {
lines, err := UI.ReadLines("/sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq") lines, err := UI.ReadLines("/sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq")
@@ -178,7 +174,6 @@ func (self *AboutPage) CpuInfo() {
} }
} }
if strings.HasPrefix(v, "model name") { if strings.HasPrefix(v, "model name") {
parts := strings.Split(v, ":") parts := strings.Split(v, ":")
processor := make(map[string]string) processor := make(map[string]string)
@@ -266,7 +261,7 @@ func (self *AboutPage) GenList() {
start_y := 10 start_y := 10
last_height := 0 last_height := 0
for _,u := range ( []string{"processor","armcores","cpuscalemhz","features","memory","uname"} ) { for _, u := range []string{"processor", "armcores", "cpuscalemhz", "features", "memory", "uname"} {
if val, ok := self.AList[u]; ok { if val, ok := self.AList[u]; ok {
li := NewInfoPageListItem() li := NewInfoPageListItem()
@@ -294,7 +289,6 @@ func (self *AboutPage) GenList() {
} }
func (self *AboutPage) Init() { func (self *AboutPage) Init() {
if self.Screen != nil { if self.Screen != nil {
@@ -315,7 +309,6 @@ func (self *AboutPage) Init() {
self.Icons["bg"] = bgpng self.Icons["bg"] = bgpng
self.CpuInfo() self.CpuInfo()
self.MemInfo() self.MemInfo()
self.CpuMhz() self.CpuMhz()
@@ -362,7 +355,6 @@ func (self *AboutPage) OnReturnBackCb() {
self.Screen.SwapAndShow() self.Screen.SwapAndShow()
} }
func (self *AboutPage) KeyDown(ev *event.Event) { func (self *AboutPage) KeyDown(ev *event.Event) {
if ev.Data["Key"] == UI.CurKeys["A"] || ev.Data["Key"] == UI.CurKeys["Menu"] { if ev.Data["Key"] == UI.CurKeys["A"] || ev.Data["Key"] == UI.CurKeys["Menu"] {
self.ReturnToUpLevelPage() self.ReturnToUpLevelPage()
@@ -384,7 +376,6 @@ func (self *AboutPage) KeyDown( ev *event.Event) {
} }
func (self *AboutPage) Draw() { func (self *AboutPage) Draw() {
if self.DrawOnce == false { if self.DrawOnce == false {
@@ -412,14 +403,12 @@ func (self *AboutPage) Draw() {
} }
} }
/******************************************************************************/ /******************************************************************************/
type AboutPlugin struct { type AboutPlugin struct {
UI.Plugin UI.Plugin
Page UI.PageInterface Page UI.PageInterface
} }
func (self *AboutPlugin) Init(main_screen *UI.MainScreen) { func (self *AboutPlugin) Init(main_screen *UI.MainScreen) {
self.Page = NewAboutPage() self.Page = NewAboutPage()
self.Page.SetScreen(main_screen) self.Page.SetScreen(main_screen)
@@ -436,11 +425,3 @@ func (self *AboutPlugin) Run( main_screen *UI.MainScreen ) {
} }
var APIOBJ AboutPlugin var APIOBJ AboutPlugin

View File

@@ -8,18 +8,16 @@ import (
"github.com/veandco/go-sdl2/ttf" "github.com/veandco/go-sdl2/ttf"
//"github.com/cuu/gogame/draw" //"github.com/cuu/gogame/draw"
"github.com/cuu/gogame/rect"
"github.com/cuu/gogame/surface"
"github.com/cuu/gogame/color" "github.com/cuu/gogame/color"
"github.com/cuu/gogame/event" "github.com/cuu/gogame/event"
"github.com/cuu/gogame/rect"
"github.com/cuu/gogame/surface"
"github.com/cuu/gogame/time" "github.com/cuu/gogame/time"
//"github.com/clockworkpi/LauncherGoDev/sysgo" //"github.com/clockworkpi/LauncherGoDev/sysgo"
"github.com/clockworkpi/LauncherGoDev/sysgo/UI" "github.com/clockworkpi/LauncherGoDev/sysgo/UI"
) )
type AirplanePage struct { type AirplanePage struct {
@@ -37,7 +35,6 @@ type AirplanePage struct {
dialog_index int //0 dialog_index int //0
Icons map[string]UI.IconItemInterface Icons map[string]UI.IconItemInterface
} }
func NewAirplanePage() *AirplanePage { func NewAirplanePage() *AirplanePage {
@@ -64,7 +61,6 @@ func (self *AirplanePage) GenList() {
} }
func (self *AirplanePage) Init() { func (self *AirplanePage) Init() {
if self.Screen != nil { if self.Screen != nil {
if self.Screen.CanvasHWND != nil && self.CanvasHWND == nil { if self.Screen.CanvasHWND != nil && self.CanvasHWND == nil {
@@ -77,7 +73,6 @@ func (self *AirplanePage) Init() {
self.Width = self.Screen.Width self.Width = self.Screen.Width
self.Height = self.Screen.Height self.Height = self.Screen.Height
airwire := UI.NewIconItem() airwire := UI.NewIconItem()
airwire.ImgSurf = UI.MyIconPool.GetImgSurf("airwire") airwire.ImgSurf = UI.MyIconPool.GetImgSurf("airwire")
airwire.MyType = UI.ICON_TYPES["STAT"] airwire.MyType = UI.ICON_TYPES["STAT"]
@@ -131,7 +126,6 @@ func (self *AirplanePage) ScrollDown() {
} }
func (self *AirplanePage) ToggleModeAni() { func (self *AirplanePage) ToggleModeAni() {
out := UI.System("sudo rfkill list | grep yes | cut -d \" \" -f3") out := UI.System("sudo rfkill list | grep yes | cut -d \" \" -f3")
@@ -218,7 +212,6 @@ func (self *AirplanePage) KeyDown(ev *event.Event) {
} }
} }
func (self *AirplanePage) Draw() { func (self *AirplanePage) Draw() {
self.ClearCanvas() self.ClearCanvas()

View File

@@ -19,7 +19,6 @@ type AirplanePlugin struct {
AirplanePage *AirplanePage AirplanePage *AirplanePage
} }
func (self *AirplanePlugin) Init(main_screen *UI.MainScreen) { func (self *AirplanePlugin) Init(main_screen *UI.MainScreen) {
self.AirplanePage = NewAirplanePage() self.AirplanePage = NewAirplanePage()
self.AirplanePage.SetScreen(main_screen) self.AirplanePage.SetScreen(main_screen)

View File

@@ -16,14 +16,14 @@ import (
"github.com/cuu/gogame/color" "github.com/cuu/gogame/color"
"github.com/cuu/gogame/font" "github.com/cuu/gogame/font"
*/ */
"github.com/cuu/gogame/time"
"github.com/cuu/gogame/event" "github.com/cuu/gogame/event"
"github.com/cuu/gogame/time"
//"github.com/godbus/dbus" //"github.com/godbus/dbus"
//"github.com/muka/go-bluetooth/api" //"github.com/muka/go-bluetooth/api"
//"github.com/muka/go-bluetooth/bluez" //"github.com/muka/go-bluetooth/bluez"
//"github.com/muka/go-bluetooth/bluez/profile" //"github.com/muka/go-bluetooth/bluez/profile"
"github.com/muka/go-bluetooth/bluez/profile/device"
"github.com/clockworkpi/LauncherGoDev/sysgo/UI" "github.com/clockworkpi/LauncherGoDev/sysgo/UI"
"github.com/muka/go-bluetooth/bluez/profile/device"
) )
type BleAgentPairPage struct { type BleAgentPairPage struct {
@@ -153,4 +153,3 @@ func (self *BleAgentPairPage) KeyDown(ev *event.Event) {
func (self *BleAgentPairPage) Draw() { func (self *BleAgentPairPage) Draw() {
// DoNothing // DoNothing
} }

View File

@@ -2,32 +2,32 @@ package Bluetooth
import ( import (
"fmt" "fmt"
"os"
"log" "log"
"os"
"strings" "strings"
//"errors" //"errors"
gotime "time"
"github.com/fatih/structs" "github.com/fatih/structs"
gotime "time"
"github.com/veandco/go-sdl2/ttf" "github.com/veandco/go-sdl2/ttf"
"github.com/cuu/gogame/draw"
"github.com/cuu/gogame/surface"
"github.com/cuu/gogame/rect"
"github.com/cuu/gogame/event"
"github.com/cuu/gogame/time"
"github.com/cuu/gogame/color" "github.com/cuu/gogame/color"
"github.com/cuu/gogame/draw"
"github.com/cuu/gogame/event"
"github.com/cuu/gogame/font" "github.com/cuu/gogame/font"
"github.com/cuu/gogame/rect"
"github.com/cuu/gogame/surface"
"github.com/cuu/gogame/time"
//"github.com/godbus/dbus" //"github.com/godbus/dbus"
bleapi "github.com/muka/go-bluetooth/api" bleapi "github.com/muka/go-bluetooth/api"
//"github.com/muka/go-bluetooth/bluez" //"github.com/muka/go-bluetooth/bluez"
// "github.com/muka/go-bluetooth/bluez/profile" // "github.com/muka/go-bluetooth/bluez/profile"
"github.com/muka/go-bluetooth/bluez/profile/device"
"github.com/muka/go-bluetooth/bluez/profile/adapter" "github.com/muka/go-bluetooth/bluez/profile/adapter"
"github.com/muka/go-bluetooth/bluez/profile/device"
logrus "github.com/sirupsen/logrus"
"github.com/clockworkpi/LauncherGoDev/sysgo/UI" "github.com/clockworkpi/LauncherGoDev/sysgo/UI"
logrus "github.com/sirupsen/logrus"
) )
func showDeviceInfo(dev *device.Device1) { func showDeviceInfo(dev *device.Device1) {
@@ -42,12 +42,8 @@ func showDeviceInfo(dev *device.Device1) {
fmt.Printf("name=%s addr=%s rssi=%d\n", props.Name, props.Address, props.RSSI) fmt.Printf("name=%s addr=%s rssi=%d\n", props.Name, props.Address, props.RSSI)
} }
type BleForgetConfirmPage struct { type BleForgetConfirmPage struct {
UI.ConfirmPage UI.ConfirmPage
} }
func NewBleForgetConfirmPage() *BleForgetConfirmPage { func NewBleForgetConfirmPage() *BleForgetConfirmPage {
@@ -75,7 +71,6 @@ func (self *BleForgetConfirmPage) KeyDown(ev *event.Event) {
self.Screen.Draw() self.Screen.Draw()
self.Screen.SwapAndShow() self.Screen.SwapAndShow()
time.BlockDelay(400) time.BlockDelay(400)
self.ReturnToUpLevelPage() self.ReturnToUpLevelPage()
self.Screen.Draw() self.Screen.Draw()
@@ -91,10 +86,8 @@ func (self *BleForgetConfirmPage) Draw() {
} }
} }
type BleInfoPageSelector struct { type BleInfoPageSelector struct {
UI.InfoPageSelector UI.InfoPageSelector
} }
func NewBleInfoPageSelector() *BleInfoPageSelector { func NewBleInfoPageSelector() *BleInfoPageSelector {
@@ -125,7 +118,6 @@ func (self *BleInfoPageSelector) Draw() {
} }
} }
type BleInfoPage struct { type BleInfoPage struct {
UI.Page UI.Page
@@ -142,7 +134,6 @@ type BleInfoPage struct {
Path string Path string
} }
func NewBleInfoPage() *BleInfoPage { func NewBleInfoPage() *BleInfoPage {
p := &BleInfoPage{} p := &BleInfoPage{}
@@ -302,7 +293,6 @@ func (self *BleInfoPage) ScrollDown() {
} }
func (self *BleInfoPage) TryToForget() { func (self *BleInfoPage) TryToForget() {
//muka Adapter1 RemoveDevice Path //muka Adapter1 RemoveDevice Path
@@ -312,7 +302,6 @@ func (self *BleInfoPage) TryToForget() {
self.Screen.MsgBox.Draw() self.Screen.MsgBox.Draw()
self.Screen.SwapAndShow() self.Screen.SwapAndShow()
err = adapter.RemoveDevice(self.MyDevice.Path()) err = adapter.RemoveDevice(self.MyDevice.Path())
if err != nil { if err != nil {
fmt.Println("BleInfoPage TryToForget: ", err) fmt.Println("BleInfoPage TryToForget: ", err)
@@ -333,7 +322,7 @@ func (self *BleInfoPage) TryToForget() {
func (self *BleInfoPage) TryToDisconnect() { func (self *BleInfoPage) TryToDisconnect() {
is_connected,_ := self.MyDevice.GetConnected(); is_connected, _ := self.MyDevice.GetConnected()
if is_connected { if is_connected {
@@ -360,12 +349,10 @@ func (self *BleInfoPage) Click() {
return return
} }
cur_li := self.MyList[self.PsIndex] cur_li := self.MyList[self.PsIndex]
fmt.Println(cur_li.(*UI.InfoPageListItem).Flag) fmt.Println(cur_li.(*UI.InfoPageListItem).Flag)
} }
func (self *BleInfoPage) OnLoadCb() { func (self *BleInfoPage) OnLoadCb() {
@@ -378,7 +365,6 @@ func (self *BleInfoPage) OnLoadCb() {
self.GenList() self.GenList()
} }
func (self *BleInfoPage) KeyDown(ev *event.Event) { func (self *BleInfoPage) KeyDown(ev *event.Event) {
if ev.Data["Key"] == UI.CurKeys["A"] || ev.Data["Key"] == UI.CurKeys["Menu"] { if ev.Data["Key"] == UI.CurKeys["A"] || ev.Data["Key"] == UI.CurKeys["Menu"] {
@@ -486,7 +472,6 @@ type BluetoothPage struct{
Connecting bool Connecting bool
Scanning bool Scanning bool
ListFontObj *ttf.Font ListFontObj *ttf.Font
Scroller *UI.ListScroller Scroller *UI.ListScroller
InfoPage *BleInfoPage InfoPage *BleInfoPage
@@ -572,7 +557,6 @@ func (self *BluetoothPage) Init() {
} }
func (self *BluetoothPage) AbortedAndReturnToUpLevel() { func (self *BluetoothPage) AbortedAndReturnToUpLevel() {
self.HideBox() self.HideBox()
@@ -673,7 +657,6 @@ func (self *BluetoothPage) RefreshDevices() {
} }
func (self *BluetoothPage) GenNetworkList() { func (self *BluetoothPage) GenNetworkList() {
self.MyList = nil self.MyList = nil
@@ -711,7 +694,6 @@ func (self *BluetoothPage) GenNetworkList() {
self.PsIndex = 0 self.PsIndex = 0
} }
func (self *BluetoothPage) Rescan() { func (self *BluetoothPage) Rescan() {
if self.Scanning == true { if self.Scanning == true {
@@ -891,7 +873,6 @@ func (self *BluetoothPage) Draw() {
return return
} }
if len(self.MyList)*NetItemDefaultHeight > self.Height { if len(self.MyList)*NetItemDefaultHeight > self.Height {
self.Ps.(*BleInfoPageSelector).Width = self.Width - 11 self.Ps.(*BleInfoPageSelector).Width = self.Width - 11
self.Ps.Draw() self.Ps.Draw()

View File

@@ -7,18 +7,17 @@ import (
//"github.com/muka/go-bluetooth/bluez/profile" //"github.com/muka/go-bluetooth/bluez/profile"
"github.com/muka/go-bluetooth/bluez/profile/device" "github.com/muka/go-bluetooth/bluez/profile/device"
"github.com/veandco/go-sdl2/ttf"
"github.com/veandco/go-sdl2/sdl" "github.com/veandco/go-sdl2/sdl"
"github.com/veandco/go-sdl2/ttf"
"github.com/cuu/gogame/rect"
"github.com/cuu/gogame/surface"
"github.com/cuu/gogame/color" "github.com/cuu/gogame/color"
"github.com/cuu/gogame/draw" "github.com/cuu/gogame/draw"
"github.com/cuu/gogame/rect"
"github.com/cuu/gogame/surface"
"github.com/clockworkpi/LauncherGoDev/sysgo/UI" "github.com/clockworkpi/LauncherGoDev/sysgo/UI"
) )
var NetItemDefaultHeight = 30 var NetItemDefaultHeight = 30
type NetItemMultiIcon struct { type NetItemMultiIcon struct {
@@ -87,7 +86,6 @@ type NetItem struct {
Device *device.Device1 Device *device.Device1
} }
func NewNetItem() *NetItem { func NewNetItem() *NetItem {
p := &NetItem{} p := &NetItem{}
@@ -100,19 +98,16 @@ func NewNetItem() *NetItem {
} }
func (self *NetItem) SetActive(act bool) { func (self *NetItem) SetActive(act bool) {
self.IsActive = act self.IsActive = act
} }
func (self *NetItem) Init(_label string) { func (self *NetItem) Init(_label string) {
self.MacAddr = self.Props.Address self.MacAddr = self.Props.Address
self.SetActive(self.Props.Connected) self.SetActive(self.Props.Connected)
name_label := UI.NewLabel() name_label := UI.NewLabel()
name_label.PosX = 12 name_label.PosX = 12

View File

@@ -35,10 +35,8 @@ const (
adapterID = "hci0" adapterID = "hci0"
BUS_NAME = "org.bluez" BUS_NAME = "org.bluez"
AGENT_INTERFACE = "org.bluez.Agent1" AGENT_INTERFACE = "org.bluez.Agent1"
) )
func (self *BluetoothPlugin) InitAgent() { func (self *BluetoothPlugin) InitAgent() {
conn, err := dbus.SystemBus() conn, err := dbus.SystemBus()
@@ -117,8 +115,6 @@ func (self *BluetoothPlugin) Init( main_screen *UI.MainScreen ) {
//self.BluetoothPage.RefreshDevices() //self.BluetoothPage.RefreshDevices()
//self.BluetoothPage.GenNetworkList() //self.BluetoothPage.GenNetworkList()
} }
func (self *BluetoothPlugin) Run(main_screen *UI.MainScreen) { func (self *BluetoothPlugin) Run(main_screen *UI.MainScreen) {

View File

@@ -8,10 +8,10 @@ import(
"github.com/veandco/go-sdl2/sdl" "github.com/veandco/go-sdl2/sdl"
"github.com/cuu/gogame/event"
"github.com/cuu/gogame/draw" "github.com/cuu/gogame/draw"
"github.com/cuu/gogame/surface" "github.com/cuu/gogame/event"
"github.com/cuu/gogame/rect" "github.com/cuu/gogame/rect"
"github.com/cuu/gogame/surface"
"github.com/clockworkpi/LauncherGoDev/sysgo" "github.com/clockworkpi/LauncherGoDev/sysgo"
"github.com/clockworkpi/LauncherGoDev/sysgo/UI" "github.com/clockworkpi/LauncherGoDev/sysgo/UI"
@@ -22,8 +22,8 @@ type OnChangeCB_T func(int)
type SliderIcon struct { type SliderIcon struct {
UI.IconItem UI.IconItem
Parent *BSlider Parent *BSlider
} }
func NewSliderIcon() *SliderIcon { func NewSliderIcon() *SliderIcon {
p := &SliderIcon{} p := &SliderIcon{}
p.MyType = UI.ICON_TYPES["EXE"] p.MyType = UI.ICON_TYPES["EXE"]
@@ -118,7 +118,6 @@ type BSlider struct {
Parent *BrightnessPage Parent *BrightnessPage
OnChangeCB OnChangeCB_T OnChangeCB OnChangeCB_T
} }
func NewBSlider() *BSlider { func NewBSlider() *BSlider {
@@ -238,7 +237,6 @@ func (self *BrightnessPage) Init() {
self.MySlider.SetValue(brt) self.MySlider.SetValue(brt)
} }
func (self *BrightnessPage) ReadBackLight() int { func (self *BrightnessPage) ReadBackLight() int {
@@ -319,4 +317,3 @@ func (self *BrightnessPage) Draw() {
self.MySlider.Draw() self.MySlider.Draw()
} }

View File

@@ -22,7 +22,6 @@ type BrightnessPlugin struct {
BrightnessPage *BrightnessPage BrightnessPage *BrightnessPage
} }
func (self *BrightnessPlugin) Init(main_screen *UI.MainScreen) { func (self *BrightnessPlugin) Init(main_screen *UI.MainScreen) {
self.BrightnessPage = NewBrightnessPage() self.BrightnessPage = NewBrightnessPage()
self.BrightnessPage.SetScreen(main_screen) self.BrightnessPage.SetScreen(main_screen)

View File

@@ -9,18 +9,16 @@ import (
"github.com/veandco/go-sdl2/ttf" "github.com/veandco/go-sdl2/ttf"
//"github.com/cuu/gogame/draw" //"github.com/cuu/gogame/draw"
"github.com/cuu/gogame/rect"
"github.com/cuu/gogame/surface"
"github.com/cuu/gogame/color" "github.com/cuu/gogame/color"
"github.com/cuu/gogame/event" "github.com/cuu/gogame/event"
"github.com/cuu/gogame/rect"
"github.com/cuu/gogame/surface"
//"github.com/cuu/gogame/time" //"github.com/cuu/gogame/time"
//"github.com/clockworkpi/LauncherGoDev/sysgo" //"github.com/clockworkpi/LauncherGoDev/sysgo"
"github.com/clockworkpi/LauncherGoDev/sysgo/UI" "github.com/clockworkpi/LauncherGoDev/sysgo/UI"
) )
type UpdateConfirmPage struct { type UpdateConfirmPage struct {
@@ -29,7 +27,6 @@ type UpdateConfirmPage struct {
RetroArchConf string RetroArchConf string
LayoutMode string LayoutMode string
} }
func NewUpdateConfirmPage() *UpdateConfirmPage { func NewUpdateConfirmPage() *UpdateConfirmPage {
@@ -171,7 +168,6 @@ func (self *UpdateConfirmPage) Draw() {
} }
type ButtonsLayoutPage struct { type ButtonsLayoutPage struct {
UI.Page UI.Page
ListFontObj *ttf.Font ListFontObj *ttf.Font
BGwidth int BGwidth int
@@ -188,7 +184,6 @@ type ButtonsLayoutPage struct {
ConfigFilename string ConfigFilename string
} }
func NewButtonsLayoutPage() *ButtonsLayoutPage { func NewButtonsLayoutPage() *ButtonsLayoutPage {
p := &ButtonsLayoutPage{} p := &ButtonsLayoutPage{}
p.PageIconMargin = 20 p.PageIconMargin = 20
@@ -222,7 +217,6 @@ func (self *ButtonsLayoutPage) Init() {
self.Width = self.Screen.Width self.Width = self.Screen.Width
self.Height = self.Screen.Height self.Height = self.Screen.Height
DialogBoxs := UI.NewMultiIconItem() DialogBoxs := UI.NewMultiIconItem()
DialogBoxs.ImgSurf = UI.MyIconPool.GetImgSurf("buttonslayout") DialogBoxs.ImgSurf = UI.MyIconPool.GetImgSurf("buttonslayout")
DialogBoxs.MyType = UI.ICON_TYPES["STAT"] DialogBoxs.MyType = UI.ICON_TYPES["STAT"]
@@ -239,7 +233,6 @@ func (self *ButtonsLayoutPage) Init() {
self.Scroller.Init() self.Scroller.Init()
self.Scroller.SetCanvasHWND(self.HWND) self.Scroller.SetCanvasHWND(self.HWND)
self.ConfirmPage = NewUpdateConfirmPage() self.ConfirmPage = NewUpdateConfirmPage()
self.ConfirmPage.LayoutMode = self.GetButtonsLayoutMode() self.ConfirmPage.LayoutMode = self.GetButtonsLayoutMode()
self.ConfirmPage.Screen = self.Screen self.ConfirmPage.Screen = self.Screen
@@ -266,7 +259,6 @@ func (self *ButtonsLayoutPage) ScrollDown() {
} }
} }
func (self *ButtonsLayoutPage) GetButtonsLayoutMode() string { func (self *ButtonsLayoutPage) GetButtonsLayoutMode() string {
lm := "xbox" lm := "xbox"
@@ -287,7 +279,6 @@ func (self *ButtonsLayoutPage) GetButtonsLayoutMode() string {
func (self *ButtonsLayoutPage) ToggleMode() { func (self *ButtonsLayoutPage) ToggleMode() {
if self.GetButtonsLayoutMode() == "xbox" { if self.GetButtonsLayoutMode() == "xbox" {
d := []byte("snes") d := []byte("snes")
err := ioutil.WriteFile(self.ConfigFilename, d, 0644) err := ioutil.WriteFile(self.ConfigFilename, d, 0644)
@@ -319,7 +310,6 @@ func (self *ButtonsLayoutPage) OnLoadCb() {
self.PosY = 0 self.PosY = 0
self.DrawOnce = false self.DrawOnce = false
if self.GetButtonsLayoutMode() == "xbox" { if self.GetButtonsLayoutMode() == "xbox" {
self.dialog_index = 0 self.dialog_index = 0
} else { } else {
@@ -335,7 +325,6 @@ func (self *ButtonsLayoutPage) OnReturnBackCb() {
} }
func (self *ButtonsLayoutPage) KeyDown(ev *event.Event) { func (self *ButtonsLayoutPage) KeyDown(ev *event.Event) {
if ev.Data["Key"] == UI.CurKeys["A"] || ev.Data["Key"] == UI.CurKeys["Menu"] { if ev.Data["Key"] == UI.CurKeys["A"] || ev.Data["Key"] == UI.CurKeys["Menu"] {
@@ -372,5 +361,3 @@ func (self *ButtonsLayoutPage) Draw() {
surface.Blit(self.HWND, self.CanvasHWND, &rect_, nil) surface.Blit(self.HWND, self.CanvasHWND, &rect_, nil)
} }
} }

View File

@@ -19,7 +19,6 @@ type ButtonsLayoutPlugin struct {
ButtonsLayoutPage *ButtonsLayoutPage ButtonsLayoutPage *ButtonsLayoutPage
} }
func (self *ButtonsLayoutPlugin) Init(main_screen *UI.MainScreen) { func (self *ButtonsLayoutPlugin) Init(main_screen *UI.MainScreen) {
self.ButtonsLayoutPage = NewButtonsLayoutPage() self.ButtonsLayoutPage = NewButtonsLayoutPage()
self.ButtonsLayoutPage.SetScreen(main_screen) self.ButtonsLayoutPage.SetScreen(main_screen)

View File

@@ -4,21 +4,20 @@ import (
"fmt" "fmt"
//"io/ioutil" //"io/ioutil"
//"path/filepath" //"path/filepath"
"strings"
"strconv"
"runtime"
"github.com/veandco/go-sdl2/ttf" "github.com/veandco/go-sdl2/ttf"
"runtime"
"strconv"
"strings"
//"github.com/mitchellh/go-homedir" //"github.com/mitchellh/go-homedir"
"github.com/cuu/gogame/draw"
"github.com/cuu/gogame/rect"
"github.com/cuu/gogame/surface"
"github.com/cuu/gogame/color"
"github.com/cuu/gogame/event"
"github.com/cuu/gogame/time"
"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/draw"
"github.com/cuu/gogame/event"
"github.com/cuu/gogame/rect"
"github.com/cuu/gogame/surface"
"github.com/cuu/gogame/time"
) )
type ListPageSelector struct { type ListPageSelector struct {
@@ -36,7 +35,6 @@ func NewListPageSelector() *ListPageSelector {
} }
func (self *ListPageSelector) Draw() { func (self *ListPageSelector) Draw() {
idx := self.Parent.GetPsIndex() idx := self.Parent.GetPsIndex()
@@ -64,7 +62,6 @@ type PageListItem struct {
Value string Value string
} }
func NewPageListItem() *PageListItem { func NewPageListItem() *PageListItem {
p := &PageListItem{} p := &PageListItem{}
@@ -77,7 +74,6 @@ func NewPageListItem() *PageListItem {
return p return p
} }
func (self *PageListItem) Draw() { func (self *PageListItem) Draw() {
x, _ := self.Labels["Text"].Coord() x, _ := self.Labels["Text"].Coord()
@@ -85,7 +81,6 @@ func (self *PageListItem) Draw() {
self.Labels["Text"].NewCoord(x, self.PosY+(self.Height-h)/2) self.Labels["Text"].NewCoord(x, self.PosY+(self.Height-h)/2)
if self.Active == true { if self.Active == true {
self.Parent.(*GateWayPage).Icons["done"].NewCoord(self.Parent.(*GateWayPage).Width-30, self.PosY+5) self.Parent.(*GateWayPage).Icons["done"].NewCoord(self.Parent.(*GateWayPage).Width-30, self.PosY+5)
self.Parent.(*GateWayPage).Icons["done"].Draw() self.Parent.(*GateWayPage).Icons["done"].Draw()
@@ -94,8 +89,6 @@ func (self *PageListItem) Draw() {
self.Labels["Text"].SetBold(self.Active) self.Labels["Text"].SetBold(self.Active)
self.Labels["Text"].Draw() self.Labels["Text"].Draw()
if _, ok := self.Labels["Small"]; ok { if _, ok := self.Labels["Small"]; ok {
x, _ = self.Labels["Small"].Coord() x, _ = self.Labels["Small"].Coord()
w, h = self.Labels["Small"].Size() w, h = self.Labels["Small"].Size()
@@ -127,7 +120,6 @@ type GateWayPage struct {
Icons map[string]UI.IconItemInterface Icons map[string]UI.IconItemInterface
} }
func NewGateWayPage() *GateWayPage { func NewGateWayPage() *GateWayPage {
p := &GateWayPage{} p := &GateWayPage{}
@@ -153,7 +145,6 @@ func (self *GateWayPage) GenList() {
var drivers = [][2]string{[2]string{"usb0", "USB Ethernet"}, var drivers = [][2]string{[2]string{"usb0", "USB Ethernet"},
[2]string{sysgo.WifiDev, "Wi-Fi"}} [2]string{sysgo.WifiDev, "Wi-Fi"}}
for _, u := range drivers { for _, u := range drivers {
li := NewPageListItem() li := NewPageListItem()
li.Parent = self li.Parent = self
@@ -421,4 +412,3 @@ func (self *GateWayPage) Draw() {
surface.Blit(self.HWND, self.CanvasHWND, &rect_, nil) surface.Blit(self.HWND, self.CanvasHWND, &rect_, nil)
} }
} }

View File

@@ -19,7 +19,6 @@ type GatewayPlugin struct {
Page1st *GateWayPage Page1st *GateWayPage
} }
func (self *GatewayPlugin) Init(main_screen *UI.MainScreen) { func (self *GatewayPlugin) Init(main_screen *UI.MainScreen) {
self.Page1st = NewGateWayPage() self.Page1st = NewGateWayPage()
self.Page1st.SetScreen(main_screen) self.Page1st.SetScreen(main_screen)

View File

@@ -8,16 +8,14 @@ import (
"github.com/veandco/go-sdl2/ttf" "github.com/veandco/go-sdl2/ttf"
"github.com/cuu/gogame/color"
"github.com/cuu/gogame/draw" "github.com/cuu/gogame/draw"
"github.com/cuu/gogame/event"
"github.com/cuu/gogame/rect" "github.com/cuu/gogame/rect"
"github.com/cuu/gogame/surface" "github.com/cuu/gogame/surface"
"github.com/cuu/gogame/color"
"github.com/cuu/gogame/event"
"github.com/cuu/gogame/time" "github.com/cuu/gogame/time"
"github.com/clockworkpi/LauncherGoDev/sysgo/UI" "github.com/clockworkpi/LauncherGoDev/sysgo/UI"
) )
type ListPageSelector struct { type ListPageSelector struct {
@@ -35,7 +33,6 @@ func NewListPageSelector() *ListPageSelector {
} }
func (self *ListPageSelector) Draw() { func (self *ListPageSelector) Draw() {
idx := self.Parent.GetPsIndex() idx := self.Parent.GetPsIndex()
@@ -63,7 +60,6 @@ type PageListItem struct {
Value string Value string
} }
func NewPageListItem() *PageListItem { func NewPageListItem() *PageListItem {
p := &PageListItem{} p := &PageListItem{}
@@ -76,7 +72,6 @@ func NewPageListItem() *PageListItem {
return p return p
} }
func (self *PageListItem) Draw() { func (self *PageListItem) Draw() {
x, _ := self.Labels["Text"].Coord() x, _ := self.Labels["Text"].Coord()
@@ -84,7 +79,6 @@ func (self *PageListItem) Draw() {
self.Labels["Text"].NewCoord(x, self.PosY+(self.Height-h)/2) self.Labels["Text"].NewCoord(x, self.PosY+(self.Height-h)/2)
if self.Active == true { if self.Active == true {
self.Parent.(*LanguagesPage).Icons["done"].NewCoord(self.Parent.(*LanguagesPage).Width-30, self.PosY+5) self.Parent.(*LanguagesPage).Icons["done"].NewCoord(self.Parent.(*LanguagesPage).Width-30, self.PosY+5)
self.Parent.(*LanguagesPage).Icons["done"].Draw() self.Parent.(*LanguagesPage).Icons["done"].Draw()
@@ -93,8 +87,6 @@ func (self *PageListItem) Draw() {
self.Labels["Text"].SetBold(self.Active) self.Labels["Text"].SetBold(self.Active)
self.Labels["Text"].Draw() self.Labels["Text"].Draw()
if _, ok := self.Labels["Small"]; ok { if _, ok := self.Labels["Small"]; ok {
x, _ = self.Labels["Small"].Coord() x, _ = self.Labels["Small"].Coord()
w, h = self.Labels["Small"].Size() w, h = self.Labels["Small"].Size()
@@ -126,7 +118,6 @@ type LanguagesPage struct {
Icons map[string]UI.IconItemInterface Icons map[string]UI.IconItemInterface
} }
func NewLanguagesPage() *LanguagesPage { func NewLanguagesPage() *LanguagesPage {
p := &LanguagesPage{} p := &LanguagesPage{}
@@ -364,4 +355,3 @@ func (self *LanguagesPage) Draw() {
surface.Blit(self.HWND, self.CanvasHWND, &rect_, nil) surface.Blit(self.HWND, self.CanvasHWND, &rect_, nil)
} }
} }

View File

@@ -19,7 +19,6 @@ type LanguagesPlugin struct {
LanguagesPage *LanguagesPage LanguagesPage *LanguagesPage
} }
func (self *LanguagesPlugin) Init(main_screen *UI.MainScreen) { func (self *LanguagesPlugin) Init(main_screen *UI.MainScreen) {
self.LanguagesPage = NewLanguagesPage() self.LanguagesPage = NewLanguagesPage()
self.LanguagesPage.SetScreen(main_screen) self.LanguagesPage.SetScreen(main_screen)

View File

@@ -1,13 +1,13 @@
package LauncherPy package LauncherPy
import ( import (
"github.com/clockworkpi/LauncherGoDev/sysgo/UI"
"github.com/cuu/gogame/time"
"log" "log"
"os/exec" "os/exec"
"os/user" "os/user"
"github.com/cuu/gogame/time"
"github.com/clockworkpi/LauncherGoDev/sysgo/UI"
) )
/******************************************************************************/ /******************************************************************************/
type LauncherPyPlugin struct { type LauncherPyPlugin struct {
UI.Plugin UI.Plugin

View File

@@ -4,20 +4,19 @@ import (
//"fmt" //"fmt"
//"io/ioutil" //"io/ioutil"
//"path/filepath" //"path/filepath"
"strings"
"runtime"
"github.com/veandco/go-sdl2/ttf"
"github.com/mitchellh/go-homedir" "github.com/mitchellh/go-homedir"
"github.com/veandco/go-sdl2/ttf"
"runtime"
"strings"
"github.com/cuu/gogame/color"
"github.com/cuu/gogame/draw" "github.com/cuu/gogame/draw"
"github.com/cuu/gogame/event"
"github.com/cuu/gogame/rect" "github.com/cuu/gogame/rect"
"github.com/cuu/gogame/surface" "github.com/cuu/gogame/surface"
"github.com/cuu/gogame/color"
"github.com/cuu/gogame/event"
"github.com/cuu/gogame/time" "github.com/cuu/gogame/time"
"github.com/clockworkpi/LauncherGoDev/sysgo/UI" "github.com/clockworkpi/LauncherGoDev/sysgo/UI"
) )
type ListPageSelector struct { type ListPageSelector struct {
@@ -35,7 +34,6 @@ func NewListPageSelector() *ListPageSelector {
} }
func (self *ListPageSelector) Draw() { func (self *ListPageSelector) Draw() {
idx := self.Parent.GetPsIndex() idx := self.Parent.GetPsIndex()
@@ -63,7 +61,6 @@ type PageListItem struct {
Value string Value string
} }
func NewPageListItem() *PageListItem { func NewPageListItem() *PageListItem {
p := &PageListItem{} p := &PageListItem{}
@@ -76,7 +73,6 @@ func NewPageListItem() *PageListItem {
return p return p
} }
func (self *PageListItem) Draw() { func (self *PageListItem) Draw() {
x, _ := self.Labels["Text"].Coord() x, _ := self.Labels["Text"].Coord()
@@ -84,7 +80,6 @@ func (self *PageListItem) Draw() {
self.Labels["Text"].NewCoord(x, self.PosY+(self.Height-h)/2) self.Labels["Text"].NewCoord(x, self.PosY+(self.Height-h)/2)
if self.Active == true { if self.Active == true {
self.Parent.(*GPUDriverPage).Icons["done"].NewCoord(self.Parent.(*GPUDriverPage).Width-30, self.PosY+5) self.Parent.(*GPUDriverPage).Icons["done"].NewCoord(self.Parent.(*GPUDriverPage).Width-30, self.PosY+5)
self.Parent.(*GPUDriverPage).Icons["done"].Draw() self.Parent.(*GPUDriverPage).Icons["done"].Draw()
@@ -93,8 +88,6 @@ func (self *PageListItem) Draw() {
self.Labels["Text"].SetBold(self.Active) self.Labels["Text"].SetBold(self.Active)
self.Labels["Text"].Draw() self.Labels["Text"].Draw()
if _, ok := self.Labels["Small"]; ok { if _, ok := self.Labels["Small"]; ok {
x, _ = self.Labels["Small"].Coord() x, _ = self.Labels["Small"].Coord()
w, h = self.Labels["Small"].Size() w, h = self.Labels["Small"].Size()
@@ -126,7 +119,6 @@ type GPUDriverPage struct {
Icons map[string]UI.IconItemInterface Icons map[string]UI.IconItemInterface
} }
func NewGPUDriverPage() *GPUDriverPage { func NewGPUDriverPage() *GPUDriverPage {
p := &GPUDriverPage{} p := &GPUDriverPage{}
@@ -152,7 +144,6 @@ func (self *GPUDriverPage) GenList() {
var drivers = [][2]string{[2]string{"fbturbo", "FBTURBO driver (Software Rendering)"}, var drivers = [][2]string{[2]string{"fbturbo", "FBTURBO driver (Software Rendering)"},
[2]string{"modesetting", "LIMA driver (Experimental Hardware Rendering)"}} [2]string{"modesetting", "LIMA driver (Experimental Hardware Rendering)"}}
for _, u := range drivers { for _, u := range drivers {
li := NewPageListItem() li := NewPageListItem()
li.Parent = self li.Parent = self
@@ -365,4 +356,3 @@ func (self *GPUDriverPage) Draw() {
surface.Blit(self.HWND, self.CanvasHWND, &rect_, nil) surface.Blit(self.HWND, self.CanvasHWND, &rect_, nil)
} }
} }

View File

@@ -19,7 +19,6 @@ type LimaPlugin struct {
GPUDriverPage *GPUDriverPage GPUDriverPage *GPUDriverPage
} }
func (self *LimaPlugin) Init(main_screen *UI.MainScreen) { func (self *LimaPlugin) Init(main_screen *UI.MainScreen) {
self.GPUDriverPage = NewGPUDriverPage() self.GPUDriverPage = NewGPUDriverPage()
self.GPUDriverPage.SetScreen(main_screen) self.GPUDriverPage.SetScreen(main_screen)

View File

@@ -19,7 +19,6 @@ type PowerOFFPlugin struct {
PowerOFFPage *PowerOFFConfirmPage PowerOFFPage *PowerOFFConfirmPage
} }
func (self *PowerOFFPlugin) Init(main_screen *UI.MainScreen) { func (self *PowerOFFPlugin) Init(main_screen *UI.MainScreen) {
self.PowerOFFPage = NewPowerOFFConfirmPage() self.PowerOFFPage = NewPowerOFFConfirmPage()
self.PowerOFFPage.SetScreen(main_screen) self.PowerOFFPage.SetScreen(main_screen)

View File

@@ -1,15 +1,12 @@
package PowerOFF package PowerOFF
import ( import (
"github.com/cuu/gogame/event"
"github.com/clockworkpi/LauncherGoDev/sysgo/UI" "github.com/clockworkpi/LauncherGoDev/sysgo/UI"
"github.com/cuu/gogame/event"
) )
type PowerOFFConfirmPage struct { type PowerOFFConfirmPage struct {
UI.ConfirmPage UI.ConfirmPage
} }
func NewPowerOFFConfirmPage() *PowerOFFConfirmPage { func NewPowerOFFConfirmPage() *PowerOFFConfirmPage {

View File

@@ -19,7 +19,6 @@ type PowerOptionsPlugin struct {
PowerOptionsPage *PowerOptionsPage PowerOptionsPage *PowerOptionsPage
} }
func (self *PowerOptionsPlugin) Init(main_screen *UI.MainScreen) { func (self *PowerOptionsPlugin) Init(main_screen *UI.MainScreen) {
self.PowerOptionsPage = NewPowerOptionsPage() self.PowerOptionsPage = NewPowerOptionsPage()
self.PowerOptionsPage.SetScreen(main_screen) self.PowerOptionsPage.SetScreen(main_screen)

View File

@@ -8,18 +8,16 @@ import (
"github.com/veandco/go-sdl2/ttf" "github.com/veandco/go-sdl2/ttf"
"github.com/cuu/gogame/color"
"github.com/cuu/gogame/draw" "github.com/cuu/gogame/draw"
"github.com/cuu/gogame/event"
"github.com/cuu/gogame/rect" "github.com/cuu/gogame/rect"
"github.com/cuu/gogame/surface" "github.com/cuu/gogame/surface"
"github.com/cuu/gogame/color"
"github.com/cuu/gogame/event"
"github.com/cuu/gogame/time" "github.com/cuu/gogame/time"
"github.com/clockworkpi/LauncherGoDev/sysgo" "github.com/clockworkpi/LauncherGoDev/sysgo"
"github.com/clockworkpi/LauncherGoDev/sysgo/UI" "github.com/clockworkpi/LauncherGoDev/sysgo/UI"
) )
type ListPageSelector struct { type ListPageSelector struct {
@@ -37,7 +35,6 @@ func NewListPageSelector() *ListPageSelector {
} }
func (self *ListPageSelector) Draw() { func (self *ListPageSelector) Draw() {
idx := self.Parent.GetPsIndex() idx := self.Parent.GetPsIndex()
@@ -65,7 +62,6 @@ type PageListItem struct {
Value string Value string
} }
func NewPageListItem() *PageListItem { func NewPageListItem() *PageListItem {
p := &PageListItem{} p := &PageListItem{}
@@ -78,7 +74,6 @@ func NewPageListItem() *PageListItem {
return p return p
} }
func (self *PageListItem) Draw() { func (self *PageListItem) Draw() {
x, _ := self.Labels["Text"].Coord() x, _ := self.Labels["Text"].Coord()
@@ -86,7 +81,6 @@ func (self *PageListItem) Draw() {
self.Labels["Text"].NewCoord(x, self.PosY+(self.Height-h)/2) self.Labels["Text"].NewCoord(x, self.PosY+(self.Height-h)/2)
if self.Active == true { if self.Active == true {
self.Parent.(*PowerOptionsPage).Icons["done"].NewCoord(self.Parent.(*PowerOptionsPage).Width-30, self.PosY+5) self.Parent.(*PowerOptionsPage).Icons["done"].NewCoord(self.Parent.(*PowerOptionsPage).Width-30, self.PosY+5)
self.Parent.(*PowerOptionsPage).Icons["done"].Draw() self.Parent.(*PowerOptionsPage).Icons["done"].Draw()
@@ -95,8 +89,6 @@ func (self *PageListItem) Draw() {
self.Labels["Text"].SetBold(self.Active) self.Labels["Text"].SetBold(self.Active)
self.Labels["Text"].Draw() self.Labels["Text"].Draw()
if _, ok := self.Labels["Small"]; ok { if _, ok := self.Labels["Small"]; ok {
x, _ = self.Labels["Small"].Coord() x, _ = self.Labels["Small"].Coord()
w, h = self.Labels["Small"].Size() w, h = self.Labels["Small"].Size()
@@ -113,7 +105,6 @@ func (self *PageListItem) Draw() {
} }
type InfoPage struct { type InfoPage struct {
UI.Page UI.Page
ListFontObj *ttf.Font ListFontObj *ttf.Font
@@ -141,7 +132,6 @@ func NewInfoPage() *InfoPage {
return p return p
} }
func (self *InfoPage) ConvertSecToMin(secs int) string { func (self *InfoPage) ConvertSecToMin(secs int) string {
sec_str := "" sec_str := ""
min_str := "" min_str := ""
@@ -169,12 +159,10 @@ func (self *InfoPage) ConvertSecToMin( secs int) string {
sec_str = fmt.Sprintf("%d "+UI.MyLangManager.Tr("second"), secs) sec_str = fmt.Sprintf("%d "+UI.MyLangManager.Tr("second"), secs)
} }
} else if secs == 0 { } else if secs == 0 {
sec_str = UI.MyLangManager.Tr("Never") sec_str = UI.MyLangManager.Tr("Never")
} }
return min_str + sec_str return min_str + sec_str
} }
@@ -228,18 +216,15 @@ func (self *InfoPage) GenList() {
time3["label"] = "Power OFF" time3["label"] = "Power OFF"
self.AList["time1"] = time1 self.AList["time1"] = time1
self.AList["time2"] = time2 self.AList["time2"] = time2
self.AList["time3"] = time3 self.AList["time3"] = time3
self.MyList = nil self.MyList = nil
start_x := 0 start_x := 0
start_y := 0 start_y := 0
i := 0 i := 0
for _, v := range self.AList { for _, v := range self.AList {
@@ -304,10 +289,8 @@ func (self *InfoPage) OnLoadCb() {
} }
func (self *InfoPage) KeyDown(ev *event.Event) { func (self *InfoPage) KeyDown(ev *event.Event) {
if ev.Data["Key"] == UI.CurKeys["A"] || ev.Data["Key"] == UI.CurKeys["Menu"] { if ev.Data["Key"] == UI.CurKeys["A"] || ev.Data["Key"] == UI.CurKeys["Menu"] {
self.ReturnToUpLevelPage() self.ReturnToUpLevelPage()
self.Screen.Draw() self.Screen.Draw()
@@ -337,7 +320,6 @@ func (self *InfoPage) Draw() {
} }
} }
type PowerOptionsPage struct { type PowerOptionsPage struct {
UI.Page UI.Page
@@ -352,7 +334,6 @@ type PowerOptionsPage struct {
Icons map[string]UI.IconItemInterface Icons map[string]UI.IconItemInterface
} }
func NewPowerOptionsPage() *PowerOptionsPage { func NewPowerOptionsPage() *PowerOptionsPage {
p := &PowerOptionsPage{} p := &PowerOptionsPage{}
@@ -403,7 +384,6 @@ func (self *PowerOptionsPage) GenList() {
self.AList["server"] = server_saving self.AList["server"] = server_saving
self.AList["performance"] = performance self.AList["performance"] = performance
for _, u := range [4]string{"supersaving", "powersaving", "server", "performance"} { for _, u := range [4]string{"supersaving", "powersaving", "server", "performance"} {
v := self.AList[u] v := self.AList[u]
@@ -431,7 +411,6 @@ func (self *PowerOptionsPage) GenList() {
} }
} }
func (self *PowerOptionsPage) Init() { func (self *PowerOptionsPage) Init() {
if self.Screen != nil { if self.Screen != nil {
@@ -563,12 +542,10 @@ func (self *PowerOptionsPage) KeyDown(ev *event.Event) {
time2 := sysgo.PowerLevels[cur_li.Value].Close time2 := sysgo.PowerLevels[cur_li.Value].Close
time3 := sysgo.PowerLevels[cur_li.Value].PowerOff time3 := sysgo.PowerLevels[cur_li.Value].PowerOff
self.InfoPage.Time1 = time1 self.InfoPage.Time1 = time1
self.InfoPage.Time2 = time2 self.InfoPage.Time2 = time2
self.InfoPage.Time3 = time3 self.InfoPage.Time3 = time3
self.Screen.PushPage(self.InfoPage) self.Screen.PushPage(self.InfoPage)
self.Screen.Draw() self.Screen.Draw()
self.Screen.SwapAndShow() self.Screen.SwapAndShow()
@@ -599,7 +576,6 @@ func (self *PowerOptionsPage) Draw() {
} }
self.Scroller.UpdateSize(len(self.MyList)*UI.DefaultInfoPageListItemHeight, self.Scroller.UpdateSize(len(self.MyList)*UI.DefaultInfoPageListItemHeight,
self.PsIndex*UI.DefaultInfoPageListItemHeight) self.PsIndex*UI.DefaultInfoPageListItemHeight)
self.Scroller.Draw() self.Scroller.Draw()
@@ -628,5 +604,3 @@ func (self *PowerOptionsPage) Draw() {
} }
} }

View File

@@ -5,40 +5,36 @@ import (
"path/filepath" "path/filepath"
// "github.com/cuu/gogame/surface" // "github.com/cuu/gogame/surface"
"github.com/cuu/gogame/event"
"github.com/cuu/gogame/rect"
"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/rect"
"github.com/clockworkpi/LauncherGoDev/sysgo/UI" "github.com/clockworkpi/LauncherGoDev/sysgo/UI"
//child packages //child packages
"github.com/clockworkpi/LauncherGoDev/Menu/GameShell/10_Settings/About" "github.com/clockworkpi/LauncherGoDev/Menu/GameShell/10_Settings/About"
"github.com/clockworkpi/LauncherGoDev/Menu/GameShell/10_Settings/Sound"
"github.com/clockworkpi/LauncherGoDev/Menu/GameShell/10_Settings/Brightness"
"github.com/clockworkpi/LauncherGoDev/Menu/GameShell/10_Settings/Wifi"
"github.com/clockworkpi/LauncherGoDev/Menu/GameShell/10_Settings/Bluetooth" "github.com/clockworkpi/LauncherGoDev/Menu/GameShell/10_Settings/Bluetooth"
"github.com/clockworkpi/LauncherGoDev/Menu/GameShell/10_Settings/Brightness"
"github.com/clockworkpi/LauncherGoDev/Menu/GameShell/10_Settings/Sound"
"github.com/clockworkpi/LauncherGoDev/Menu/GameShell/10_Settings/Wifi"
"github.com/clockworkpi/LauncherGoDev/Menu/GameShell/10_Settings/Update"
"github.com/clockworkpi/LauncherGoDev/Menu/GameShell/10_Settings/Storage"
"github.com/clockworkpi/LauncherGoDev/Menu/GameShell/10_Settings/Languages" "github.com/clockworkpi/LauncherGoDev/Menu/GameShell/10_Settings/Languages"
"github.com/clockworkpi/LauncherGoDev/Menu/GameShell/10_Settings/Storage"
"github.com/clockworkpi/LauncherGoDev/Menu/GameShell/10_Settings/Update"
"github.com/clockworkpi/LauncherGoDev/Menu/GameShell/10_Settings/PowerOFF"
"github.com/clockworkpi/LauncherGoDev/Menu/GameShell/10_Settings/PowerOptions"
"github.com/clockworkpi/LauncherGoDev/Menu/GameShell/10_Settings/Airplane" "github.com/clockworkpi/LauncherGoDev/Menu/GameShell/10_Settings/Airplane"
"github.com/clockworkpi/LauncherGoDev/Menu/GameShell/10_Settings/ButtonsLayout" "github.com/clockworkpi/LauncherGoDev/Menu/GameShell/10_Settings/ButtonsLayout"
"github.com/clockworkpi/LauncherGoDev/Menu/GameShell/10_Settings/PowerOFF"
"github.com/clockworkpi/LauncherGoDev/Menu/GameShell/10_Settings/PowerOptions"
"github.com/clockworkpi/LauncherGoDev/Menu/GameShell/10_Settings/TimeZone" "github.com/clockworkpi/LauncherGoDev/Menu/GameShell/10_Settings/TimeZone"
//"github.com/clockworkpi/LauncherGoDev/Menu/GameShell/10_Settings/Lima" //"github.com/clockworkpi/LauncherGoDev/Menu/GameShell/10_Settings/Lima"
"github.com/clockworkpi/LauncherGoDev/Menu/GameShell/10_Settings/GateWay" "github.com/clockworkpi/LauncherGoDev/Menu/GameShell/10_Settings/GateWay"
) )
type SettingsPageSelector struct { type SettingsPageSelector struct {
UI.PageSelector UI.PageSelector
BackgroundColor *color.Color BackgroundColor *color.Color
} }
func NewSettingsPageSelector() *SettingsPageSelector { func NewSettingsPageSelector() *SettingsPageSelector {
@@ -85,7 +81,6 @@ type SettingsPage struct {
Icons map[string]UI.IconItemInterface Icons map[string]UI.IconItemInterface
MyPath string MyPath string
} }
func NewSettingsPage() *SettingsPage { func NewSettingsPage() *SettingsPage {
@@ -132,13 +127,11 @@ func (self *SettingsPage) Init() {
self.Height = self.Screen.Height self.Height = self.Screen.Height
self.CanvasHWND = self.Screen.CanvasHWND self.CanvasHWND = self.Screen.CanvasHWND
ps := NewSettingsPageSelector() ps := NewSettingsPageSelector()
ps.Parent = self ps.Parent = self
self.Ps = ps self.Ps = ps
self.PsIndex = 0 self.PsIndex = 0
start_x := 0 start_x := 0
start_y := 0 start_y := 0
@@ -204,7 +197,6 @@ func (self *SettingsPage) ScrollUp() {
} }
} }
func (self *SettingsPage) ScrollDown() { func (self *SettingsPage) ScrollDown() {
if len(self.MyList) == 0 { if len(self.MyList) == 0 {
return return
@@ -252,7 +244,6 @@ func (self *SettingsPage) KeyDown( ev *event.Event) {
self.Screen.SwapAndShow() self.Screen.SwapAndShow()
} }
if ev.Data["Key"] == UI.CurKeys["Up"] { if ev.Data["Key"] == UI.CurKeys["Up"] {
self.ScrollUp() self.ScrollUp()
self.Screen.Draw() self.Screen.Draw()
@@ -270,7 +261,6 @@ func (self *SettingsPage) KeyDown( ev *event.Event) {
} }
} }
func (self *SettingsPage) Draw() { func (self *SettingsPage) Draw() {
self.ClearCanvas() self.ClearCanvas()
@@ -303,14 +293,12 @@ func (self *SettingsPage) Draw() {
} }
} }
/******************************************************************************/ /******************************************************************************/
type SettingsPlugin struct { type SettingsPlugin struct {
UI.Plugin UI.Plugin
Page UI.PageInterface Page UI.PageInterface
} }
func (self *SettingsPlugin) Init(main_screen *UI.MainScreen) { func (self *SettingsPlugin) Init(main_screen *UI.MainScreen) {
self.Page = NewSettingsPage() self.Page = NewSettingsPage()
self.Page.SetScreen(main_screen) self.Page.SetScreen(main_screen)

View File

@@ -23,7 +23,6 @@ type SoundPlugin struct {
SoundPage *SoundPage SoundPage *SoundPage
} }
func (self *SoundPlugin) Init(main_screen *UI.MainScreen) { func (self *SoundPlugin) Init(main_screen *UI.MainScreen) {
self.SoundPage = NewSoundPage() self.SoundPage = NewSoundPage()
self.SoundPage.SetScreen(main_screen) self.SoundPage.SetScreen(main_screen)

View File

@@ -2,12 +2,12 @@ package Sound
import ( import (
"fmt" "fmt"
"github.com/veandco/go-sdl2/sdl"
"github.com/cuu/gogame/event" "github.com/cuu/gogame/event"
"github.com/veandco/go-sdl2/sdl"
"github.com/cuu/gogame/surface"
"github.com/cuu/gogame/draw" "github.com/cuu/gogame/draw"
"github.com/cuu/gogame/rect" "github.com/cuu/gogame/rect"
"github.com/cuu/gogame/surface"
"github.com/clockworkpi/LauncherGoDev/sysgo/UI" "github.com/clockworkpi/LauncherGoDev/sysgo/UI"
) )
@@ -17,7 +17,6 @@ type OnChangeCB_T func(int)
type SliderIcon struct { type SliderIcon struct {
UI.IconItem UI.IconItem
Parent *SoundSlider Parent *SoundSlider
} }
func NewSliderIcon() *SliderIcon { func NewSliderIcon() *SliderIcon {
@@ -57,7 +56,6 @@ func (self *SliderIcon) Draw() {
} }
} }
type SliderMultiIcon struct { type SliderMultiIcon struct {
UI.MultiIconItem UI.MultiIconItem
Parent *SoundSlider Parent *SoundSlider
@@ -207,12 +205,10 @@ func (self *SoundSlider) Draw() {
} }
type SoundPage struct { type SoundPage struct {
UI.Page UI.Page
MySlider *SoundSlider MySlider *SoundSlider
} }
func NewSoundPage() *SoundPage { func NewSoundPage() *SoundPage {
@@ -291,9 +287,7 @@ func (self *SoundPage) KeyDown(ev *event.Event) {
} }
func (self *SoundPage) Draw() { func (self *SoundPage) Draw() {
self.ClearCanvas() self.ClearCanvas()
self.MySlider.Draw() self.MySlider.Draw()
} }

View File

@@ -1,4 +1,6 @@
//go:build !windows && !darwin
// +build !windows,!darwin // +build !windows,!darwin
/* /*
* Copied from https://github.com/itchyny/volume-go, MIT License * Copied from https://github.com/itchyny/volume-go, MIT License
*/ */

View File

@@ -1,4 +1,6 @@
//go:build !windows
// +build !windows // +build !windows
/* /*
* Copied from https://github.com/itchyny/volume-go, MIT License * Copied from https://github.com/itchyny/volume-go, MIT License
*/ */

View File

@@ -1,6 +1,5 @@
package Storage package Storage
import ( import (
/* /*
"github.com/veandco/go-sdl2/ttf" "github.com/veandco/go-sdl2/ttf"
@@ -11,7 +10,6 @@ import (
"github.com/cuu/gogame/color" "github.com/cuu/gogame/color"
*/ */
"github.com/clockworkpi/LauncherGoDev/sysgo/UI" "github.com/clockworkpi/LauncherGoDev/sysgo/UI"
) )
/******************************************************************************/ /******************************************************************************/
@@ -20,7 +18,6 @@ type StoragePlugin struct {
StoragePage *StoragePage StoragePage *StoragePage
} }
func (self *StoragePlugin) Init(main_screen *UI.MainScreen) { func (self *StoragePlugin) Init(main_screen *UI.MainScreen) {
self.StoragePage = NewStoragePage() self.StoragePage = NewStoragePage()
self.StoragePage.SetScreen(main_screen) self.StoragePage.SetScreen(main_screen)

View File

@@ -4,11 +4,10 @@ import (
"fmt" "fmt"
"syscall" "syscall"
"github.com/cuu/gogame/draw"
"github.com/cuu/gogame/color" "github.com/cuu/gogame/color"
"github.com/cuu/gogame/draw"
"github.com/clockworkpi/LauncherGoDev/sysgo/UI" "github.com/clockworkpi/LauncherGoDev/sysgo/UI"
) )
const ( const (
@@ -142,8 +141,6 @@ func (self *StoragePage) Draw() {
rect2_.X = rect_.X rect2_.X = rect_.X
rect2_.Y = rect_.Y rect2_.Y = rect_.Y
draw.AARoundRect(self.CanvasHWND, rect2_, &color.Color{131, 199, 219, 255}, 5, 0, &color.Color{131, 199, 219, 255}) draw.AARoundRect(self.CanvasHWND, rect2_, &color.Color{131, 199, 219, 255}, 5, 0, &color.Color{131, 199, 219, 255})
} }

View File

@@ -4,17 +4,16 @@ import (
//"fmt" //"fmt"
//"strings" //"strings"
//"io/ioutil" //"io/ioutil"
"path/filepath"
"github.com/veandco/go-sdl2/ttf" "github.com/veandco/go-sdl2/ttf"
"path/filepath"
//"github.com/veandco/go-sdl2/sdl" //"github.com/veandco/go-sdl2/sdl"
//"github.com/cuu/gogame/surface" //"github.com/cuu/gogame/surface"
//"github.com/cuu/gogame/rect" //"github.com/cuu/gogame/rect"
"github.com/cuu/gogame/color" "github.com/cuu/gogame/color"
"github.com/cuu/gogame/draw"
"github.com/clockworkpi/LauncherGoDev/sysgo/UI" "github.com/clockworkpi/LauncherGoDev/sysgo/UI"
"github.com/cuu/gogame/draw"
) )
var TimeZoneListPageListItemDefaultHeight = 30 var TimeZoneListPageListItemDefaultHeight = 30
@@ -22,7 +21,6 @@ var TimeZoneListPageListItemDefaultHeight = 30
type TimeZoneListPageInterface interface { type TimeZoneListPageInterface interface {
UI.PageInterface UI.PageInterface
GetMapIcons() map[string]UI.IconItemInterface GetMapIcons() map[string]UI.IconItemInterface
} }
type TimeZoneListPageListItem struct { type TimeZoneListPageListItem struct {
@@ -40,7 +38,6 @@ func NewTimeZoneListPageListItem() *TimeZoneListPageListItem {
p.Height = TimeZoneListPageListItemDefaultHeight p.Height = TimeZoneListPageListItemDefaultHeight
p.Width = 0 p.Width = 0
return p return p
} }
@@ -69,7 +66,6 @@ func (self *TimeZoneListPageListItem) Draw() {
x, y := self.Labels["Text"].Coord() x, y := self.Labels["Text"].Coord()
_, h := self.Labels["Text"].Size() _, h := self.Labels["Text"].Size()
if self.Path != "[..]" { if self.Path != "[..]" {
self.Labels["Text"].NewCoord(23, y) self.Labels["Text"].NewCoord(23, y)
@@ -101,5 +97,3 @@ func (self *TimeZoneListPageListItem) Draw() {
self.PosX, self.PosY+self.Height-1, self.PosX+self.Width, self.PosY+self.Height-1, 1) self.PosX, self.PosY+self.Height-1, self.PosX+self.Width, self.PosY+self.Height-1, 1)
} }

View File

@@ -19,7 +19,6 @@ type TimeZonePlugin struct {
TimeZonePage *TimeZoneListPage TimeZonePage *TimeZoneListPage
} }
func (self *TimeZonePlugin) Init(main_screen *UI.MainScreen) { func (self *TimeZonePlugin) Init(main_screen *UI.MainScreen) {
self.TimeZonePage = NewTimeZoneListPage() self.TimeZonePage = NewTimeZoneListPage()
self.TimeZonePage.SetScreen(main_screen) self.TimeZonePage.SetScreen(main_screen)

View File

@@ -8,15 +8,15 @@ import (
"github.com/veandco/go-sdl2/ttf" "github.com/veandco/go-sdl2/ttf"
"github.com/cuu/gogame/draw"
"github.com/cuu/gogame/rect"
"github.com/cuu/gogame/color" "github.com/cuu/gogame/color"
"github.com/cuu/gogame/draw"
"github.com/cuu/gogame/event" "github.com/cuu/gogame/event"
"github.com/cuu/gogame/rect"
"github.com/cuu/gogame/time" "github.com/cuu/gogame/time"
"github.com/clockworkpi/LauncherGoDev/sysgo/UI" "github.com/clockworkpi/LauncherGoDev/sysgo/UI"
) )
var TimeZonePath = "/usr/share/zoneinfo/posix" var TimeZonePath = "/usr/share/zoneinfo/posix"
type ListPageSelector struct { type ListPageSelector struct {
@@ -34,7 +34,6 @@ func NewListPageSelector() *ListPageSelector {
} }
func (self *ListPageSelector) Draw() { func (self *ListPageSelector) Draw() {
idx := self.Parent.GetPsIndex() idx := self.Parent.GetPsIndex()
@@ -55,8 +54,6 @@ func (self *ListPageSelector) Draw() {
} }
} }
type TimeZoneListPage struct { type TimeZoneListPage struct {
UI.Page UI.Page
@@ -74,15 +71,11 @@ type TimeZoneListPage struct {
} }
type ListEle struct { type ListEle struct {
Name string Name string
FilePath string FilePath string
IsFile bool IsFile bool
} }
func NewTimeZoneListPage() *TimeZoneListPage { func NewTimeZoneListPage() *TimeZoneListPage {
p := &TimeZoneListPage{} p := &TimeZoneListPage{}
@@ -138,7 +131,6 @@ func (self *TimeZoneListPage) SyncList(path string) {
self.MyList = nil self.MyList = nil
self.SwapMyList = nil self.SwapMyList = nil
start_x := 0 start_x := 0
start_y := 0 start_y := 0
@@ -181,7 +173,6 @@ func (self *TimeZoneListPage) SyncList(path string) {
self.MyList = append(self.MyList, li) self.MyList = append(self.MyList, li)
} }
for _, v := range self.MyList { for _, v := range self.MyList {
self.SwapMyList = append(self.SwapMyList, v) self.SwapMyList = append(self.SwapMyList, v)
} }
@@ -229,7 +220,6 @@ func (self *TimeZoneListPage) Init() {
} }
func (self *TimeZoneListPage) Click() { func (self *TimeZoneListPage) Click() {
if len(self.MyList) == 0 { if len(self.MyList) == 0 {
return return
@@ -271,7 +261,6 @@ func (self *TimeZoneListPage) Click() {
self.Screen.SwapAndShow() self.Screen.SwapAndShow()
} }
func (self *TimeZoneListPage) Rescan() { func (self *TimeZoneListPage) Rescan() {
self.SyncList(TimeZonePath) self.SyncList(TimeZonePath)
self.PsIndex = 0 self.PsIndex = 0
@@ -357,8 +346,4 @@ func (self *TimeZoneListPage) Draw() {
} }
} }
} }

View File

@@ -1,14 +1,15 @@
package Update package Update
import ( import (
"github.com/clockworkpi/LauncherGoDev/sysgo/UI" "github.com/clockworkpi/LauncherGoDev/sysgo/UI"
) )
/******************************************************************************/ /******************************************************************************/
type UpdatePlugin struct { type UpdatePlugin struct {
UI.Plugin UI.Plugin
Page UI.PageInterface Page UI.PageInterface
} }
func (self *UpdatePlugin) Init(main_screen *UI.MainScreen) { func (self *UpdatePlugin) Init(main_screen *UI.MainScreen) {
self.Page = NewUpdatePage() self.Page = NewUpdatePage()
self.Page.SetScreen(main_screen) self.Page.SetScreen(main_screen)

View File

@@ -1,15 +1,15 @@
package Update package Update
import ( import (
"fmt"
"bytes" "bytes"
"encoding/json"
"fmt"
"github.com/cuu/gogame/time"
"github.com/veandco/go-sdl2/ttf"
"net/http"
"os/exec"
"strings" "strings"
gotime "time" gotime "time"
"os/exec"
"encoding/json"
"net/http"
"github.com/veandco/go-sdl2/ttf"
"github.com/cuu/gogame/time"
// "github.com/cuu/gogame/surface" // "github.com/cuu/gogame/surface"
"github.com/cuu/gogame/event" "github.com/cuu/gogame/event"
//"github.com/cuu/gogame/rect" //"github.com/cuu/gogame/rect"
@@ -162,7 +162,6 @@ func (self *UpdatePage) CheckUpdate() bool {
GitVersion string `json:"gitversion"` GitVersion string `json:"gitversion"`
} }
timeout := gotime.Duration(8 * gotime.Second) timeout := gotime.Duration(8 * gotime.Second)
client := http.Client{ client := http.Client{
Timeout: timeout, Timeout: timeout,
@@ -218,7 +217,6 @@ func (self *UpdatePage) CheckUpdate() bool {
defer resp.Body.Close() defer resp.Body.Close()
return true return true
} }

View File

@@ -5,16 +5,15 @@ import (
//"strconv" //"strconv"
//"strings" //"strings"
"github.com/veandco/go-sdl2/sdl" "github.com/clockworkpi/LauncherGoDev/sysgo/UI"
"github.com/veandco/go-sdl2/ttf"
"github.com/cuu/gogame/color" "github.com/cuu/gogame/color"
"github.com/cuu/gogame/draw" "github.com/cuu/gogame/draw"
"github.com/cuu/gogame/rect" "github.com/cuu/gogame/rect"
"github.com/cuu/gogame/surface" "github.com/cuu/gogame/surface"
"github.com/clockworkpi/LauncherGoDev/sysgo/UI" "github.com/veandco/go-sdl2/sdl"
"github.com/veandco/go-sdl2/ttf"
) )
var NetItemDefaultHeight = 30 var NetItemDefaultHeight = 30
type NetItemMultiIcon struct { type NetItemMultiIcon struct {
@@ -64,7 +63,6 @@ func (self *NetItemIcon) Draw() {
} }
type NetItem struct { type NetItem struct {
UI.Widget UI.Widget
@@ -83,8 +81,6 @@ type NetItem struct {
Icons map[string]UI.IconItemInterface Icons map[string]UI.IconItemInterface
Fonts map[string]*ttf.Font Fonts map[string]*ttf.Font
FontObj *ttf.Font FontObj *ttf.Font
} }
func NewNetItem() *NetItem { func NewNetItem() *NetItem {
@@ -122,7 +118,6 @@ func (self *NetItem) Init(is_active bool) {
self.SetActive(is_active) self.SetActive(is_active)
} }
essid_label := UI.NewLabel() essid_label := UI.NewLabel()
essid_label.PosX = 36 essid_label.PosX = 36
essid_label.CanvasHWND = self.Parent.GetCanvasHWND() essid_label.CanvasHWND = self.Parent.GetCanvasHWND()
@@ -182,10 +177,8 @@ func (self *NetItem) Init(is_active bool) {
self.Icons["wifistatus"] = nimt self.Icons["wifistatus"] = nimt
} }
func (self *NetItem) Connect() { func (self *NetItem) Connect() {
} }
func (self *NetItem) CalcWifiQuality() int { func (self *NetItem) CalcWifiQuality() int {

View File

@@ -15,7 +15,6 @@ import (
//"github.com/clockworkpi/LauncherGoDev/sysgo/DBUS" //"github.com/clockworkpi/LauncherGoDev/sysgo/DBUS"
wifi "github.com/cuu/wpa-connect" wifi "github.com/cuu/wpa-connect"
) )
/******************************************************************************/ /******************************************************************************/
@@ -30,7 +29,6 @@ var (
GsConnectManager = wifi.NewConnectManager(sysgo.WifiDev) GsConnectManager = wifi.NewConnectManager(sysgo.WifiDev)
) )
func (self *WifiPlugin) Init(main_screen *UI.MainScreen) { func (self *WifiPlugin) Init(main_screen *UI.MainScreen) {
self.PasswordPage = UI.NewKeyboard() self.PasswordPage = UI.NewKeyboard()

View File

@@ -1,4 +1,5 @@
package Wifi package Wifi
//wifi_list.py //wifi_list.py
import ( import (
@@ -13,15 +14,15 @@ import (
"github.com/veandco/go-sdl2/ttf" "github.com/veandco/go-sdl2/ttf"
"github.com/cuu/gogame/surface"
"github.com/cuu/gogame/font"
"github.com/cuu/gogame/color"
"github.com/cuu/gogame/event"
"github.com/cuu/gogame/time"
"github.com/cuu/gogame/rect"
"github.com/cuu/gogame/draw"
"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/draw"
"github.com/cuu/gogame/event"
"github.com/cuu/gogame/font"
"github.com/cuu/gogame/rect"
"github.com/cuu/gogame/surface"
"github.com/cuu/gogame/time"
wifi "github.com/cuu/wpa-connect" wifi "github.com/cuu/wpa-connect"
) )
@@ -256,7 +257,6 @@ func (self *WifiInfoPage) OnLoadCb() {
self.GenList() self.GenList()
} }
func (self *WifiInfoPage) OnReturnBackCb() { func (self *WifiInfoPage) OnReturnBackCb() {
self.ReturnToUpLevelPage() self.ReturnToUpLevelPage()
@@ -303,7 +303,6 @@ func (self *WifiInfoPage) Draw() {
} }
} }
type WifiListSelector struct { type WifiListSelector struct {
UI.PageSelector UI.PageSelector
BackgroundColor *color.Color BackgroundColor *color.Color
@@ -345,7 +344,6 @@ p := &WifiListMessageBox{}
return p return p
} }
func (self *WifiListMessageBox) Draw() { func (self *WifiListMessageBox) Draw() {
my_text := font.Render(self.FontObj, self.Text, true, self.Color, nil) my_text := font.Render(self.FontObj, self.Text, true, self.Color, nil)
@@ -432,7 +430,6 @@ func (self *WifiList) GenNetworkList() {
var li_idx int var li_idx int
li_idx = 0 li_idx = 0
self.WifiScanStarted() self.WifiScanStarted()
if bssList, err := GsScanManager.Scan(); err == nil { if bssList, err := GsScanManager.Scan(); err == nil {
@@ -477,7 +474,6 @@ func (self *WifiList) Disconnect() {
self.CurEssid = "" self.CurEssid = ""
self.CurBssid = "" self.CurBssid = ""
} }
func (self *WifiList) ShutDownConnecting() { func (self *WifiList) ShutDownConnecting() {
@@ -518,10 +514,10 @@ func (self *WifiList) WifiScanStarted( ) {
fmt.Println("dbus says start scan") fmt.Println("dbus says start scan")
} }
func (self *WifiList) SaveNetworkList() { func (self *WifiList) SaveNetworkList() {
} }
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------
func (self *WifiList) UpdateNetList(state int, info []string, force_check bool, firstrun bool) { //force_check default ==false, firstrun default == false func (self *WifiList) UpdateNetList(state int, info []string, force_check bool, firstrun bool) { //force_check default ==false, firstrun default == false
@@ -778,5 +774,3 @@ func (self *WifiList) Draw() {
self.Scroller.Draw() self.Scroller.Draw()
} }

View File

@@ -17,7 +17,6 @@ import (
type TinyCloudPlugin struct { type TinyCloudPlugin struct {
UI.Plugin UI.Plugin
MainPage *TinyCloudPage MainPage *TinyCloudPage
} }
func (self *TinyCloudPlugin) Init(main_screen *UI.MainScreen) { func (self *TinyCloudPlugin) Init(main_screen *UI.MainScreen) {

View File

@@ -3,15 +3,14 @@ package TinyCloud
import ( import (
"fmt" "fmt"
"github.com/veandco/go-sdl2/ttf"
"github.com/cuu/gogame/surface"
"github.com/cuu/gogame/event" "github.com/cuu/gogame/event"
"github.com/cuu/gogame/rect" "github.com/cuu/gogame/rect"
"github.com/cuu/gogame/surface"
"github.com/veandco/go-sdl2/ttf"
"github.com/cuu/gogame/color" "github.com/cuu/gogame/color"
"github.com/clockworkpi/LauncherGoDev/sysgo/UI" "github.com/clockworkpi/LauncherGoDev/sysgo/UI"
) )
type TinyCloudLabel struct { type TinyCloudLabel struct {
@@ -19,7 +18,6 @@ type TinyCloudLabel struct {
Lable string Lable string
Font *ttf.Font Font *ttf.Font
Color *color.Color Color *color.Color
} }
type TinyCloudPage struct { type TinyCloudPage struct {
@@ -103,7 +101,6 @@ func (self *TinyCloudPage) SetLabels() {
self.IP = "xxx.xxx.xxx.xxx" self.IP = "xxx.xxx.xxx.xxx"
} }
labels := []*TinyCloudLabel{ labels := []*TinyCloudLabel{
&TinyCloudLabel{"forssh", "For ssh and scp:", self.ListFontObj, self.TextColor}, &TinyCloudLabel{"forssh", "For ssh and scp:", self.ListFontObj, self.TextColor},
&TinyCloudLabel{"ssh_addr", fmt.Sprintf("ssh cpi@%s", self.IP), self.ListFontObj, self.URLColor}, &TinyCloudLabel{"ssh_addr", fmt.Sprintf("ssh cpi@%s", self.IP), self.ListFontObj, self.URLColor},
@@ -183,7 +180,6 @@ func (self *TinyCloudPage) Draw() {
self.Icons["online"].NewCoord(self.Coords["online"].X, self.Coords["online"].Y) self.Icons["online"].NewCoord(self.Coords["online"].X, self.Coords["online"].Y)
self.Icons["online"].Draw() self.Icons["online"].Draw()
for k, _ := range self.Labels { for k, _ := range self.Labels {
if _, ok := self.Coords[k]; ok { if _, ok := self.Coords[k]; ok {
self.Labels[k].NewCoord(self.Coords[k].X, self.Coords[k].Y) self.Labels[k].NewCoord(self.Coords[k].X, self.Coords[k].Y)
@@ -203,8 +199,6 @@ func (self *TinyCloudPage) Draw() {
self.Labels["usb-eth-addr"].NewCoord(self.Coords["usb-eth-addr"].X+55, self.Coords["usb-eth-addr"].Y) self.Labels["usb-eth-addr"].NewCoord(self.Coords["usb-eth-addr"].X+55, self.Coords["usb-eth-addr"].Y)
self.Labels["usb-eth-addr"].Draw() self.Labels["usb-eth-addr"].Draw()
} }
if self.HWND != nil { if self.HWND != nil {

View File

@@ -19,7 +19,6 @@ type PowerOFFPlugin struct {
PowerOFFPage *PowerOFFConfirmPage PowerOFFPage *PowerOFFConfirmPage
} }
func (self *PowerOFFPlugin) Init(main_screen *UI.MainScreen) { func (self *PowerOFFPlugin) Init(main_screen *UI.MainScreen) {
self.PowerOFFPage = NewPowerOFFConfirmPage() self.PowerOFFPage = NewPowerOFFConfirmPage()
self.PowerOFFPage.SetScreen(main_screen) self.PowerOFFPage.SetScreen(main_screen)

View File

@@ -1,15 +1,12 @@
package PowerOFF package PowerOFF
import ( import (
"github.com/cuu/gogame/event"
"github.com/clockworkpi/LauncherGoDev/sysgo/UI" "github.com/clockworkpi/LauncherGoDev/sysgo/UI"
"github.com/cuu/gogame/event"
) )
type PowerOFFConfirmPage struct { type PowerOFFConfirmPage struct {
UI.ConfirmPage UI.ConfirmPage
} }
func NewPowerOFFConfirmPage() *PowerOFFConfirmPage { func NewPowerOFFConfirmPage() *PowerOFFConfirmPage {

23
main.go
View File

@@ -1,20 +1,19 @@
package main package main
import ( import (
"os"
"fmt" "fmt"
"log"
"io/ioutil" "io/ioutil"
"log"
"os"
"os/exec"
"path/filepath"
"runtime"
"strconv" "strconv"
"strings" "strings"
"runtime"
"path/filepath"
"os/exec"
"syscall" "syscall"
//"encoding/json" //"encoding/json"
gotime "time"
"github.com/veandco/go-sdl2/sdl" "github.com/veandco/go-sdl2/sdl"
gotime "time"
//"github.com/go-ini/ini" //"github.com/go-ini/ini"
"github.com/cuu/gogame" "github.com/cuu/gogame"
"github.com/cuu/gogame/display" "github.com/cuu/gogame/display"
@@ -26,8 +25,6 @@ import (
"github.com/clockworkpi/LauncherGoDev/sysgo" "github.com/clockworkpi/LauncherGoDev/sysgo"
"github.com/clockworkpi/LauncherGoDev/sysgo/UI" "github.com/clockworkpi/LauncherGoDev/sysgo/UI"
) )
var ( var (
@@ -39,7 +36,6 @@ var (
everytime_keydown = gotime.Now() everytime_keydown = gotime.Now()
sound_patch *UI.SoundPatch sound_patch *UI.SoundPatch
) )
// flash the Led1 on the GS back // flash the Led1 on the GS back
@@ -171,7 +167,6 @@ func InspectionTeam(main_screen *UI.MainScreen) {
} }
} }
main_screen.TitleBar.InLowBackLight = 0 main_screen.TitleBar.InLowBackLight = 0
if time2 != 0 { if time2 != 0 {
passout_time_stage = 1 // next passout_time_stage = 1 // next
@@ -348,14 +343,13 @@ func run() int {
running := true running := true
for running { for running {
ev := event.Poll() ev := event.Wait()
if ev.Type == event.QUIT { if ev.Type == event.QUIT {
running = false running = false
break break
} }
if ev.Type == event.USEREVENT { if ev.Type == event.USEREVENT {
fmt.Println("UserEvent: ", ev.Data["Msg"]) fmt.Println("UserEvent: ", ev.Data["Msg"])
switch ev.Code { switch ev.Code {
@@ -447,7 +441,6 @@ func run() int {
} }
} }
if ev.Type == event.KEYDOWN { if ev.Type == event.KEYDOWN {
everytime_keydown = gotime.Now() everytime_keydown = gotime.Now()
@@ -455,13 +448,11 @@ func run() int {
continue continue
} }
if ev.Data["Key"] == "Q" { if ev.Data["Key"] == "Q" {
main_screen.OnExitCb() main_screen.OnExitCb()
return 0 return 0
} }
if ev.Data["Key"] == "Keypad +" { if ev.Data["Key"] == "Keypad +" {
if main_screen.CurPage().GetName() != "Sound volume" { if main_screen.CurPage().GetName() != "Sound volume" {
main_screen.Draw() main_screen.Draw()

View File

@@ -3,8 +3,8 @@ package main
import ( import (
//"os" //"os"
"fmt" "fmt"
"log"
"io/ioutil" "io/ioutil"
"log"
// "strconv" // "strconv"
"strings" "strings"
// "runtime" // "runtime"
@@ -17,11 +17,11 @@ import (
"github.com/yookoala/realpath" "github.com/yookoala/realpath"
"github.com/clockworkpi/LauncherGoDev/sysgo/UI"
"github.com/clockworkpi/LauncherGoDev/sysgo/UI/Emulator"
"github.com/clockworkpi/LauncherGoDev/Menu/GameShell/10_Settings" "github.com/clockworkpi/LauncherGoDev/Menu/GameShell/10_Settings"
"github.com/clockworkpi/LauncherGoDev/Menu/GameShell/98_TinyCloud" "github.com/clockworkpi/LauncherGoDev/Menu/GameShell/98_TinyCloud"
"github.com/clockworkpi/LauncherGoDev/Menu/GameShell/99_PowerOFF" "github.com/clockworkpi/LauncherGoDev/Menu/GameShell/99_PowerOFF"
"github.com/clockworkpi/LauncherGoDev/sysgo/UI"
"github.com/clockworkpi/LauncherGoDev/sysgo/UI/Emulator"
) )
var ( var (
@@ -100,7 +100,6 @@ func ReunionPagesIcons(self *UI.MainScreen) {
} }
func ReadTheDirIntoPages(self *UI.MainScreen, _dir string, pglevel int, cur_page UI.PageInterface) { func ReadTheDirIntoPages(self *UI.MainScreen, _dir string, pglevel int, cur_page UI.PageInterface) {
if UI.FileExists(_dir) == false && UI.IsDirectory(_dir) == false { if UI.FileExists(_dir) == false && UI.IsDirectory(_dir) == false {

View File

@@ -67,7 +67,6 @@ func (self *DbusInterface) EnableSignal(signame string) {
self.Obj.AddMatchSignal(iface, signame) self.Obj.AddMatchSignal(iface, signame)
} }
func (self *DbusInterface) HandleSignal(sig *dbus.Signal) { func (self *DbusInterface) HandleSignal(sig *dbus.Signal) {
iface := self.Dest iface := self.Dest
@@ -115,7 +114,7 @@ func (self *DBus) Init() {
self.Conn = conn self.Conn = conn
self.Daemon = NewDbusInterface(conn, "org.wicd.daemon","/org/wicd/daemon" ,"",) self.Daemon = NewDbusInterface(conn, "org.wicd.daemon", "/org/wicd/daemon", "")
self.Wifi = NewDbusInterface(conn, "org.wicd.daemon", "/org/wicd/daemon/wireless", "wireless") self.Wifi = NewDbusInterface(conn, "org.wicd.daemon", "/org/wicd/daemon/wireless", "wireless")
} }

View File

@@ -1,7 +1,6 @@
package Emulator package Emulator
import ( import (
"github.com/clockworkpi/LauncherGoDev/sysgo/UI" "github.com/clockworkpi/LauncherGoDev/sysgo/UI"
) )
@@ -17,14 +16,11 @@ type ActionConfig struct {
RETRO_CONFIG string `ini:"RETRO_CONFIG"` RETRO_CONFIG string `ini:"RETRO_CONFIG"`
} }
var ( var (
FavGID = 31415 FavGID = 31415
FavGname = "cpifav" FavGname = "cpifav"
) )
type MyEmulator struct { // as leader of RomListPage and FavListPage, it's a PluginInterface type MyEmulator struct { // as leader of RomListPage and FavListPage, it's a PluginInterface
Name string Name string
RomPage *RomListPage RomPage *RomListPage
@@ -34,7 +30,6 @@ type MyEmulator struct { // as leader of RomListPage and FavListPage, it's a Plu
SpeedMax int SpeedMax int
SpeedTimeInter int SpeedTimeInter int
} }
func NewMyEmulator() *MyEmulator { func NewMyEmulator() *MyEmulator {
@@ -70,8 +65,6 @@ func (self *MyEmulator) Init(main_screen *UI.MainScreen) {
self.FavPage.Leader = self self.FavPage.Leader = self
self.FavPage.Init() self.FavPage.Init()
} }
func (self *MyEmulator) Run(main_screen *UI.MainScreen) { func (self *MyEmulator) Run(main_screen *UI.MainScreen) {
@@ -82,6 +75,3 @@ func (self *MyEmulator) Run(main_screen *UI.MainScreen) {
main_screen.SwapAndShow() main_screen.SwapAndShow()
} }
} }

View File

@@ -1,20 +1,19 @@
package Emulator package Emulator
import ( import (
"fmt"
"os"
"strings"
"path/filepath"
"errors" "errors"
gotime "time" "fmt"
"github.com/veandco/go-sdl2/ttf" "github.com/veandco/go-sdl2/ttf"
"os"
"path/filepath"
"strings"
gotime "time"
"github.com/cuu/gogame/event" "github.com/cuu/gogame/event"
"github.com/clockworkpi/LauncherGoDev/sysgo/UI"
"github.com/cuu/gogame/color" "github.com/cuu/gogame/color"
"github.com/cuu/gogame/time" "github.com/cuu/gogame/time"
"github.com/clockworkpi/LauncherGoDev/sysgo/UI"
) )
type FavListPage struct { type FavListPage struct {
@@ -32,7 +31,6 @@ type FavListPage struct {
Scroller *UI.ListScroller Scroller *UI.ListScroller
Scrolled int Scrolled int
Leader *MyEmulator Leader *MyEmulator
} }
func NewFavListPage() *FavListPage { func NewFavListPage() *FavListPage {
@@ -234,7 +232,6 @@ func (self *FavListPage) Init() {
self.RomSoConfirmDownloadPage = rom_so_confirm_page self.RomSoConfirmDownloadPage = rom_so_confirm_page
} }
func (self *FavListPage) ScrollUp() { func (self *FavListPage) ScrollUp() {
if len(self.MyList) == 0 { if len(self.MyList) == 0 {
return return
@@ -261,7 +258,6 @@ func (self *FavListPage) ScrollUp() {
} }
} }
func (self *FavListPage) ScrollDown() { func (self *FavListPage) ScrollDown() {
if len(self.MyList) == 0 { if len(self.MyList) == 0 {
return return
@@ -319,19 +315,16 @@ func (self *FavListPage) SyncScroll() {
} }
} }
func (self *FavListPage) Click() { func (self *FavListPage) Click() {
if len(self.MyList) == 0 { if len(self.MyList) == 0 {
return return
} }
if self.PsIndex > len(self.MyList)-1 { if self.PsIndex > len(self.MyList)-1 {
return return
} }
cur_li := self.MyList[self.PsIndex] cur_li := self.MyList[self.PsIndex]
if cur_li.(*EmulatorListItem).MyType == UI.ICON_TYPES["DIR"] { if cur_li.(*EmulatorListItem).MyType == UI.ICON_TYPES["DIR"] {
@@ -406,7 +399,6 @@ func (self *FavListPage) ReScan() {
self.SyncList(self.MyStack.Last()) self.SyncList(self.MyStack.Last())
} }
idx := self.PsIndex idx := self.PsIndex
if idx > len(self.MyList)-1 { if idx > len(self.MyList)-1 {
@@ -423,7 +415,6 @@ func (self *FavListPage) ReScan() {
self.SyncScroll() self.SyncScroll()
} }
func (self *FavListPage) OnReturnBackCb() { func (self *FavListPage) OnReturnBackCb() {
self.ReScan() self.ReScan()
self.Screen.Draw() self.Screen.Draw()
@@ -517,7 +508,6 @@ func (self *FavListPage) Draw() {
self.Ps.NewSize(self.Width-10, h) self.Ps.NewSize(self.Width-10, h)
self.Ps.Draw() self.Ps.Draw()
for _, v := range self.MyList { for _, v := range self.MyList {
_, y := v.Coord() _, y := v.Coord()
if y > self.Height+self.Height/2 { if y > self.Height+self.Height/2 {
@@ -535,8 +525,6 @@ func (self *FavListPage) Draw() {
self.PsIndex*UI.HierListItemDefaultHeight) self.PsIndex*UI.HierListItemDefaultHeight)
self.Scroller.Draw() self.Scroller.Draw()
} else { } else {
self.Ps.NewSize(self.Width, h) self.Ps.NewSize(self.Width, h)
self.Ps.Draw() self.Ps.Draw()
@@ -546,5 +534,3 @@ func (self *FavListPage) Draw() {
} }
} }
} }

View File

@@ -2,19 +2,18 @@ package Emulator
import ( import (
"fmt" "fmt"
"strings" "github.com/veandco/go-sdl2/ttf"
"io/ioutil" "io/ioutil"
"path/filepath" "path/filepath"
"github.com/veandco/go-sdl2/ttf" "strings"
//"github.com/veandco/go-sdl2/sdl" //"github.com/veandco/go-sdl2/sdl"
//"github.com/cuu/gogame/surface" //"github.com/cuu/gogame/surface"
//"github.com/cuu/gogame/rect" //"github.com/cuu/gogame/rect"
"github.com/cuu/gogame/color" "github.com/cuu/gogame/color"
"github.com/cuu/gogame/draw"
"github.com/clockworkpi/LauncherGoDev/sysgo/UI" "github.com/clockworkpi/LauncherGoDev/sysgo/UI"
"github.com/cuu/gogame/draw"
) )
type EmulatorPageInterface interface { type EmulatorPageInterface interface {
@@ -23,7 +22,6 @@ type EmulatorPageInterface interface {
GetEmulatorConfig() *ActionConfig GetEmulatorConfig() *ActionConfig
} }
type EmulatorListItem struct { type EmulatorListItem struct {
UI.HierListItem UI.HierListItem
Parent EmulatorPageInterface Parent EmulatorPageInterface
@@ -39,7 +37,6 @@ func NewEmulatorListItem() *EmulatorListItem {
p.Height = 32 p.Height = 32
p.Width = 0 p.Width = 0
return p return p
} }
@@ -82,7 +79,6 @@ func (self *EmulatorListItem) Draw() {
x, y := self.Labels["Text"].Coord() x, y := self.Labels["Text"].Coord()
_, h := self.Labels["Text"].Size() _, h := self.Labels["Text"].Size()
if self.Path != "[..]" { if self.Path != "[..]" {
self.Labels["Text"].NewCoord(23, y) self.Labels["Text"].NewCoord(23, y)
@@ -114,5 +110,3 @@ func (self *EmulatorListItem) Draw() {
self.PosX, self.PosY+self.Height-1, self.PosX+self.Width, self.PosY+self.Height-1, 1) self.PosX, self.PosY+self.Height-1, self.PosX+self.Width, self.PosY+self.Height-1, 1)
} }

View File

@@ -5,16 +5,15 @@ import (
"os" "os"
"strings" "strings"
//"regexp" //"regexp"
"path/filepath"
"os/exec"
"errors" "errors"
gotime "time" "github.com/clockworkpi/LauncherGoDev/sysgo/UI"
"github.com/veandco/go-sdl2/ttf"
"github.com/cuu/gogame/time"
"github.com/cuu/gogame/color" "github.com/cuu/gogame/color"
"github.com/cuu/gogame/event" "github.com/cuu/gogame/event"
"github.com/clockworkpi/LauncherGoDev/sysgo/UI" "github.com/cuu/gogame/time"
"github.com/veandco/go-sdl2/ttf"
"os/exec"
"path/filepath"
gotime "time"
) )
type RomListPage struct { type RomListPage struct {
@@ -33,7 +32,6 @@ type RomListPage struct {
Scrolled int Scrolled int
Leader *MyEmulator Leader *MyEmulator
} }
func NewRomListPage() *RomListPage { func NewRomListPage() *RomListPage {
@@ -70,7 +68,6 @@ func (self *RomListPage) GetEmulatorConfig() *ActionConfig {
return self.EmulatorConfig return self.EmulatorConfig
} }
func (self *RomListPage) GeneratePathList(path string) ([]map[string]string, error) { func (self *RomListPage) GeneratePathList(path string) ([]map[string]string, error) {
if UI.IsDirectory(path) == false { if UI.IsDirectory(path) == false {
return nil, errors.New("Path is not a folder") return nil, errors.New("Path is not a folder")
@@ -259,7 +256,6 @@ func (self *RomListPage) Init() {
self.RomSoConfirmDownloadPage = rom_so_confirm_page self.RomSoConfirmDownloadPage = rom_so_confirm_page
} }
func (self *RomListPage) ScrollUp() { func (self *RomListPage) ScrollUp() {
if len(self.MyList) == 0 { if len(self.MyList) == 0 {
return return
@@ -288,7 +284,6 @@ func (self *RomListPage) ScrollUp() {
} }
} }
func (self *RomListPage) ScrollDown() { func (self *RomListPage) ScrollDown() {
if len(self.MyList) == 0 { if len(self.MyList) == 0 {
return return
@@ -349,18 +344,15 @@ func (self *RomListPage) SyncScroll() {
} }
} }
func (self *RomListPage) Click() { func (self *RomListPage) Click() {
if len(self.MyList) == 0 { if len(self.MyList) == 0 {
return return
} }
if self.PsIndex > len(self.MyList)-1 { if self.PsIndex > len(self.MyList)-1 {
return return
} }
cur_li := self.MyList[self.PsIndex] cur_li := self.MyList[self.PsIndex]
if cur_li.(*EmulatorListItem).MyType == UI.ICON_TYPES["DIR"] { if cur_li.(*EmulatorListItem).MyType == UI.ICON_TYPES["DIR"] {
@@ -441,14 +433,12 @@ func (self *RomListPage) ReScan() {
self.SyncScroll() self.SyncScroll()
} }
func (self *RomListPage) OnReturnBackCb() { func (self *RomListPage) OnReturnBackCb() {
self.ReScan() self.ReScan()
self.Screen.Draw() self.Screen.Draw()
self.Screen.SwapAndShow() self.Screen.SwapAndShow()
} }
func (self *RomListPage) SpeedScroll(thekey string) { func (self *RomListPage) SpeedScroll(thekey string) {
if self.Screen.LastKey == thekey { if self.Screen.LastKey == thekey {
self.ScrollStep += 1 self.ScrollStep += 1
@@ -581,5 +571,3 @@ func (self *RomListPage) Draw() {
} }
} }
} }

View File

@@ -7,17 +7,15 @@ import (
"path/filepath" "path/filepath"
"github.com/cuu/gogame/event"
"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/event"
) )
type RomSoConfirmPage struct { type RomSoConfirmPage struct {
UI.ConfirmPage UI.ConfirmPage
Parent EmulatorPageInterface Parent EmulatorPageInterface
DownloadPage *UI.DownloadProcessPage DownloadPage *UI.DownloadProcessPage
} }
func NewRomSoConfirmPage() *RomSoConfirmPage { func NewRomSoConfirmPage() *RomSoConfirmPage {
@@ -118,5 +116,4 @@ func (self *RomSoConfirmPage) Draw() {
v.Draw() v.Draw()
} }
} }

View File

@@ -1,13 +1,12 @@
package UI package UI
import ( import (
"fmt" "fmt"
"github.com/veandco/go-sdl2/ttf" "github.com/veandco/go-sdl2/ttf"
"github.com/cuu/gogame/font"
"github.com/clockworkpi/LauncherGoDev/sysgo" "github.com/clockworkpi/LauncherGoDev/sysgo"
"github.com/cuu/gogame/font"
) )
type WidgetInterface interface { type WidgetInterface interface {
@@ -25,7 +24,6 @@ type Coord struct {
type Plane struct { type Plane struct {
W int W int
H int H int
} }
type Widget struct { type Widget struct {
@@ -63,7 +61,6 @@ func Init() {
fonts_path := make(map[string]string) fonts_path := make(map[string]string)
fonts_path["varela"] = fmt.Sprintf("%s/VarelaRound-Regular.ttf", skinpath) fonts_path["varela"] = fmt.Sprintf("%s/VarelaRound-Regular.ttf", skinpath)
fonts_path["veramono"] = fmt.Sprintf("%s/VeraMono.ttf", skinpath) fonts_path["veramono"] = fmt.Sprintf("%s/VeraMono.ttf", skinpath)
fonts_path["noto"] = fmt.Sprintf("%s/NotoSansMono-Regular.ttf", skinpath) fonts_path["noto"] = fmt.Sprintf("%s/NotoSansMono-Regular.ttf", skinpath)
@@ -110,5 +107,3 @@ func Init() {
MySkinManager.Init() MySkinManager.Init()
} }
} }

View File

@@ -4,13 +4,12 @@ import(
"github.com/veandco/go-sdl2/sdl" "github.com/veandco/go-sdl2/sdl"
"github.com/veandco/go-sdl2/ttf" "github.com/veandco/go-sdl2/ttf"
"github.com/cuu/gogame/color"
"github.com/cuu/gogame/draw" "github.com/cuu/gogame/draw"
"github.com/cuu/gogame/rect" "github.com/cuu/gogame/rect"
"github.com/cuu/gogame/color"
) )
type AboveAllPatch struct { type AboveAllPatch struct {
Widget Widget
Text string Text string
@@ -72,5 +71,3 @@ func (self *AboveAllPatch) Draw() {
draw.AARoundRect(self.CanvasHWND, &vol_rect, self.ValColor, 3, 0, self.ValColor) draw.AARoundRect(self.CanvasHWND, &vol_rect, self.ValColor, 3, 0, self.ValColor)
} }
} }

View File

@@ -5,12 +5,11 @@ import (
"github.com/veandco/go-sdl2/ttf" "github.com/veandco/go-sdl2/ttf"
// "github.com/cuu/gogame/surface" // "github.com/cuu/gogame/surface"
"github.com/cuu/gogame/color"
"github.com/cuu/gogame/event" "github.com/cuu/gogame/event"
"github.com/cuu/gogame/rect" "github.com/cuu/gogame/rect"
"github.com/cuu/gogame/color"
// "github.com/cuu/gogame/font" // "github.com/cuu/gogame/font"
"github.com/cuu/gogame/draw" "github.com/cuu/gogame/draw"
) )
type ListPageSelector struct { type ListPageSelector struct {
@@ -49,7 +48,6 @@ func (self *ListPageSelector) Draw() {
rect_ := rect.Rect(self.PosX, self.PosY, self.Width-4, self.Height) rect_ := rect.Rect(self.PosX, self.PosY, self.Width-4, self.Height)
draw.AARoundRect(canvas_, &rect_, self.BackgroundColor, 4, 0, self.BackgroundColor) draw.AARoundRect(canvas_, &rect_, self.BackgroundColor, 4, 0, self.BackgroundColor)
} }
type ConfirmPage struct { type ConfirmPage struct {
@@ -65,10 +63,8 @@ type ConfirmPage struct {
Icons map[string]IconItemInterface Icons map[string]IconItemInterface
MyList []LabelInterface MyList []LabelInterface
} }
func NewConfirmPage() *ConfirmPage { func NewConfirmPage() *ConfirmPage {
p := &ConfirmPage{} p := &ConfirmPage{}
p.ListFont = Fonts["veramono20"] p.ListFont = Fonts["veramono20"]
@@ -78,7 +74,6 @@ func NewConfirmPage() *ConfirmPage {
return p return p
} }
func (self *ConfirmPage) Reset() { func (self *ConfirmPage) Reset() {
self.MyList[0].SetText(self.ConfirmText) self.MyList[0].SetText(self.ConfirmText)
x, y := self.MyList[0].Coord() x, y := self.MyList[0].Coord()
@@ -142,7 +137,6 @@ func (self *ConfirmPage) Init() {
} }
} }
func (self *ConfirmPage) KeyDown(ev *event.Event) { func (self *ConfirmPage) KeyDown(ev *event.Event) {
if ev.Data["Key"] == CurKeys["A"] || ev.Data["Key"] == CurKeys["Menu"] { if ev.Data["Key"] == CurKeys["A"] || ev.Data["Key"] == CurKeys["Menu"] {
@@ -159,7 +153,6 @@ func (self *ConfirmPage) DrawBG() {
draw.Rect(self.CanvasHWND, &color.Color{83, 83, 83, 255}, &rect_, 1) //SkinManager().GiveColor('Text') draw.Rect(self.CanvasHWND, &color.Color{83, 83, 83, 255}, &rect_, 1) //SkinManager().GiveColor('Text')
} }
func (self *ConfirmPage) Draw() { func (self *ConfirmPage) Draw() {
self.DrawBG() self.DrawBG()
for _, v := range self.MyList { for _, v := range self.MyList {

View File

@@ -1,4 +1,3 @@
package UI package UI
var ( var (
@@ -12,7 +11,6 @@ var (
ALIGN = map[string]int{"HLeft": 0, "HCenter": 1, "HRight": 2, "VMiddle": 3, "SLeft": 4, "VCenter": 5, "SCenter": 6} ALIGN = map[string]int{"HLeft": 0, "HCenter": 1, "HRight": 2, "VMiddle": 3, "SLeft": 4, "VCenter": 5, "SCenter": 6}
DT = 50 DT = 50
) )
var ( var (

View File

@@ -2,20 +2,19 @@ package UI
import ( import (
"fmt" "fmt"
gotime "time"
"github.com/veandco/go-sdl2/ttf" "github.com/veandco/go-sdl2/ttf"
gotime "time"
"github.com/cuu/gogame/color" "github.com/cuu/gogame/color"
"github.com/cuu/gogame/event" "github.com/cuu/gogame/event"
"github.com/cuu/gogame/surface" "github.com/cuu/gogame/surface"
"github.com/clockworkpi/LauncherGoDev/sysgo" "github.com/clockworkpi/LauncherGoDev/sysgo"
) )
type CounterScreen struct { type CounterScreen struct {
FullScreen FullScreen
CounterFont *ttf.Font CounterFont *ttf.Font
TextFont1 *ttf.Font TextFont1 *ttf.Font
TextFont2 *ttf.Font TextFont2 *ttf.Font
@@ -34,7 +33,6 @@ type CounterScreen struct {
TheTicker *gotime.Ticker TheTicker *gotime.Ticker
TickerStoped chan bool TickerStoped chan bool
} }
func NewCounterScreen() *CounterScreen { func NewCounterScreen() *CounterScreen {
@@ -96,7 +94,6 @@ func (self *CounterScreen ) Interval() {
} }
func (self *CounterScreen) StartCounter() { func (self *CounterScreen) StartCounter() {
if self.Counting == true { if self.Counting == true {
return return
@@ -113,7 +110,6 @@ func (self *CounterScreen) StartCounter() {
} }
func (self *CounterScreen) StopCounter() { func (self *CounterScreen) StopCounter() {
if self.Counting == false { if self.Counting == false {
return return
@@ -140,7 +136,6 @@ func (self *CounterScreen) Init() {
self.BottomLabel.SetCanvasHWND(self.CanvasHWND) self.BottomLabel.SetCanvasHWND(self.CanvasHWND)
self.BottomLabel.Init("Press any key to stop countdown", self.TextFont2, self.FGColor) self.BottomLabel.Init("Press any key to stop countdown", self.TextFont2, self.FGColor)
self.NumberLabel = NewLabel() self.NumberLabel = NewLabel()
self.NumberLabel.SetCanvasHWND(self.CanvasHWND) self.NumberLabel.SetCanvasHWND(self.CanvasHWND)
number_str := fmt.Sprintf("%d", self.Number) number_str := fmt.Sprintf("%d", self.Number)
@@ -165,4 +160,3 @@ func (self *CounterScreen) Draw() {
self.NumberLabel.DrawCenter(false) self.NumberLabel.DrawCenter(false)
} }

View File

@@ -12,21 +12,17 @@ import(
type DeleteConfirmPage struct { type DeleteConfirmPage struct {
ConfirmPage ConfirmPage
} }
func NewDeleteConfirmPage() *DeleteConfirmPage { func NewDeleteConfirmPage() *DeleteConfirmPage {
p := &DeleteConfirmPage{} p := &DeleteConfirmPage{}
p.ListFont = Fonts["veramono20"] p.ListFont = Fonts["veramono20"]
p.FootMsg = [5]string{"Nav", "", "", "Cancel", "Yes"} p.FootMsg = [5]string{"Nav", "", "", "Cancel", "Yes"}
p.ConfirmText = "Confirm Delete ?" p.ConfirmText = "Confirm Delete ?"
return p return p
} }
func (self *DeleteConfirmPage) SetTrashDir(d string) { func (self *DeleteConfirmPage) SetTrashDir(d string) {
self.TrashDir = d self.TrashDir = d
if IsDirectory(self.TrashDir) == false { if IsDirectory(self.TrashDir) == false {

View File

@@ -3,18 +3,17 @@ package UI
import ( import (
"fmt" "fmt"
"os" "os"
"strings"
"path/filepath"
"os/exec" "os/exec"
"path/filepath"
"strings"
gotime "time"
"net/url" "net/url"
gotime "time"
"github.com/cuu/grab"
"github.com/cuu/gogame/color" "github.com/cuu/gogame/color"
"github.com/cuu/gogame/event"
"github.com/cuu/gogame/draw" "github.com/cuu/gogame/draw"
"github.com/cuu/gogame/event"
"github.com/cuu/grab"
) )
type DownloadProcessPage struct { type DownloadProcessPage struct {
@@ -38,10 +37,8 @@ type DownloadProcessPage struct {
Downloader *grab.Client Downloader *grab.Client
resp *grab.Response resp *grab.Response
req *grab.Request req *grab.Request
} }
func NewDownloadProcessPage() *DownloadProcessPage { func NewDownloadProcessPage() *DownloadProcessPage {
p := &DownloadProcessPage{} p := &DownloadProcessPage{}
@@ -129,7 +126,6 @@ func (self *DownloadProcessPage) UpdateProcessInterval() {
self.FileNameLabel.SetText(filepath.Base(self.resp.Filename)) self.FileNameLabel.SetText(filepath.Base(self.resp.Filename))
self.Screen.Draw() self.Screen.Draw()
self.Screen.SwapAndShow() self.Screen.SwapAndShow()
@@ -195,8 +191,6 @@ func (self *DownloadProcessPage) DoneAndReturnUpLevel() {
self.Screen.SwapAndShow() self.Screen.SwapAndShow()
} }
func (self *DownloadProcessPage) StartDownload(_url, dst_dir string) { func (self *DownloadProcessPage) StartDownload(_url, dst_dir string) {
if self.Screen.IsWifiConnectedNow() == false { if self.Screen.IsWifiConnectedNow() == false {
@@ -265,7 +259,6 @@ func (self *DownloadProcessPage) Draw() {
draw.AARoundRect(self.CanvasHWND, rect_, draw.AARoundRect(self.CanvasHWND, rect_,
&color.Color{228, 228, 228, 255}, 5, 0, &color.Color{228, 228, 228, 255}) &color.Color{228, 228, 228, 255}, 5, 0, &color.Color{228, 228, 228, 255})
rect2_ := draw.MidRect(self.Width/2, self.Height/2+33, int(170.0*(float64(percent)/100.0)), 17, Width, Height) rect2_ := draw.MidRect(self.Width/2, self.Height/2+33, int(170.0*(float64(percent)/100.0)), 17, Width, Height)
rect2_.X = rect_.X rect2_.X = rect_.X

View File

@@ -1,6 +1,5 @@
package UI package UI
const ( const (
RUNEVT = 1 RUNEVT = 1
RESTARTUI = 2 RESTARTUI = 2

View File

@@ -2,7 +2,6 @@ package UI
import ( import (
"sync" "sync"
) )
type FolderStack struct { type FolderStack struct {

View File

@@ -1,8 +1,7 @@
package UI package UI
import ( import (
"github.com/veandco/go-sdl2/ttf" "github.com/veandco/go-sdl2/ttf"
) )
var Fonts map[string]*ttf.Font var Fonts map[string]*ttf.Font

View File

@@ -8,12 +8,11 @@ import (
"github.com/veandco/go-sdl2/sdl" "github.com/veandco/go-sdl2/sdl"
"github.com/veandco/go-sdl2/ttf" "github.com/veandco/go-sdl2/ttf"
"github.com/cuu/gogame/draw"
"github.com/cuu/gogame/font"
"github.com/cuu/gogame/image"
"github.com/cuu/gogame/rect" "github.com/cuu/gogame/rect"
"github.com/cuu/gogame/surface" "github.com/cuu/gogame/surface"
"github.com/cuu/gogame/draw"
"github.com/cuu/gogame/image"
"github.com/cuu/gogame/font"
) )
var FootBar_BarHeight = 20 var FootBar_BarHeight = 20
@@ -89,10 +88,8 @@ type FootBar struct {
SkinManager *SkinManager SkinManager *SkinManager
icon_base_path string icon_base_path string
} }
func NewFootBar() *FootBar { func NewFootBar() *FootBar {
f := &FootBar{} f := &FootBar{}
f.Width = Width f.Width = Width
@@ -141,7 +138,6 @@ func (self *FootBar) ReadFootBarIcons( icondir string) {
} }
} }
func (self *FootBar) Init(main_screen *MainScreen) { func (self *FootBar) Init(main_screen *MainScreen) {
self.CanvasHWND = surface.Surface(self.Width, self.Height) self.CanvasHWND = surface.Surface(self.Width, self.Height)
self.HWND = main_screen.HWND self.HWND = main_screen.HWND
@@ -215,7 +211,6 @@ func (self *FootBar) ClearCanvas() {
self.Icons["round_corners"].SetIconIndex(2) self.Icons["round_corners"].SetIconIndex(2)
self.Icons["round_corners"].Draw() self.Icons["round_corners"].Draw()
self.Icons["round_corners"].NewCoord(self.Width-5, self.Height-5) self.Icons["round_corners"].NewCoord(self.Width-5, self.Height-5)
self.Icons["round_corners"].SetIconIndex(3) self.Icons["round_corners"].SetIconIndex(3)

View File

@@ -1,19 +1,16 @@
package UI package UI
import ( import (
"github.com/veandco/go-sdl2/sdl"
"github.com/cuu/gogame/surface" "github.com/cuu/gogame/surface"
"github.com/veandco/go-sdl2/sdl"
"github.com/cuu/gogame/rect" "github.com/cuu/gogame/rect"
) )
type FullScreen struct { type FullScreen struct {
Widget Widget
CanvasHWND *sdl.Surface CanvasHWND *sdl.Surface
HWND *sdl.Surface HWND *sdl.Surface
} }
func NewFullScreen() *FullScreen { func NewFullScreen() *FullScreen {
@@ -36,5 +33,4 @@ func (self *FullScreen) SwapAndShow() {
func (self *FullScreen) Draw() { func (self *FullScreen) Draw() {
} }

View File

@@ -2,23 +2,21 @@ package UI
import ( import (
"fmt" "fmt"
"io/ioutil"
"path/filepath" "path/filepath"
"strings" "strings"
"io/ioutil"
"github.com/veandco/go-sdl2/ttf" "github.com/veandco/go-sdl2/ttf"
"github.com/cuu/gogame/rect" "github.com/cuu/gogame/rect"
"github.com/cuu/gogame/surface"
"github.com/cuu/gogame/draw"
"github.com/cuu/gogame/color" "github.com/cuu/gogame/color"
"github.com/cuu/gogame/draw"
"github.com/cuu/gogame/surface"
) )
type ListItemIcon struct { type ListItemIcon struct {
IconItem IconItem
} }
func NewListItemIcon() *ListItemIcon { func NewListItemIcon() *ListItemIcon {
@@ -73,7 +71,6 @@ func (self *HierListItem) IsFile() bool {
return false return false
} }
func (self *HierListItem) IsDir() bool { func (self *HierListItem) IsDir() bool {
if self.MyType == ICON_TYPES["DIR"] { if self.MyType == ICON_TYPES["DIR"] {
return true return true
@@ -82,7 +79,6 @@ func (self *HierListItem) IsDir() bool {
return false return false
} }
func (self *HierListItem) Init(text string) { func (self *HierListItem) Init(text string) {
l := NewLabel() l := NewLabel()
l.PosX = 20 l.PosX = 20
@@ -138,7 +134,6 @@ func (self *HierListItem) Draw() {
self.Labels["Text"].Draw() self.Labels["Text"].Draw()
/* /*
w,h := self.Parent.Icons["sys"].Size() w,h := self.Parent.Icons["sys"].Size()

View File

@@ -6,14 +6,13 @@ import (
"github.com/veandco/go-sdl2/sdl" "github.com/veandco/go-sdl2/sdl"
"github.com/veandco/go-sdl2/ttf" "github.com/veandco/go-sdl2/ttf"
"github.com/cuu/gogame/surface"
"github.com/cuu/gogame/draw"
"github.com/cuu/gogame/color" "github.com/cuu/gogame/color"
"github.com/cuu/gogame/draw"
"github.com/cuu/gogame/image" "github.com/cuu/gogame/image"
"github.com/cuu/gogame/rect"
"github.com/cuu/gogame/surface"
"github.com/cuu/gogame/transform" "github.com/cuu/gogame/transform"
"github.com/cuu/gogame/utils" "github.com/cuu/gogame/utils"
"github.com/cuu/gogame/rect"
) )
type IconItemInterface interface { type IconItemInterface interface {
@@ -59,7 +58,6 @@ type IconItemInterface interface {
GetFileName() string GetFileName() string
Draw() Draw()
DrawTopLeft() DrawTopLeft()
} }
type IconItem struct { type IconItem struct {
@@ -79,7 +77,6 @@ type IconItem struct {
FileName string FileName string
} }
func NewIconItem() *IconItem { func NewIconItem() *IconItem {
i := &IconItem{} i := &IconItem{}
i.MyType = ICON_TYPES["EXE"] i.MyType = ICON_TYPES["EXE"]
@@ -89,7 +86,6 @@ func NewIconItem() *IconItem {
return i return i
} }
func (self *IconItem) Init(x, y, w, h, at int) { func (self *IconItem) Init(x, y, w, h, at int) {
self.PosX = x self.PosX = x
self.PosY = y self.PosY = y
@@ -114,7 +110,6 @@ func (self *IconItem) Adjust(x,y,w,h,at int) {
} }
func (self *IconItem) GetCmdPath() string { func (self *IconItem) GetCmdPath() string {
return self.CmdPath return self.CmdPath
} }
@@ -214,7 +209,6 @@ func (self *IconItem) AdjustLinkPage() {
} }
} }
func (self *IconItem) GetImgSurf() *sdl.Surface { func (self *IconItem) GetImgSurf() *sdl.Surface {
return self.ImgSurf return self.ImgSurf
} }
@@ -223,7 +217,6 @@ func (self *IconItem) SetImgSurf(newsurf *sdl.Surface) {
self.ImgSurf = newsurf self.ImgSurf = newsurf
} }
func (self *IconItem) CreateImgSurf() { func (self *IconItem) CreateImgSurf() {
if self.ImgSurf == nil && self.ImageName != "" { if self.ImgSurf == nil && self.ImageName != "" {
self.ImgSurf = image.Load(self.ImageName) self.ImgSurf = image.Load(self.ImageName)
@@ -307,4 +300,3 @@ func (self *IconItem) Draw() {
self.Width, self.Height, Width, Height), nil) self.Width, self.Height, Width, Height), nil)
} }
} }

View File

@@ -9,7 +9,6 @@ import (
"github.com/veandco/go-sdl2/sdl" "github.com/veandco/go-sdl2/sdl"
"github.com/cuu/gogame/image" "github.com/cuu/gogame/image"
) )
type IconPool struct { type IconPool struct {
@@ -24,7 +23,6 @@ func NewIconPool() *IconPool {
return i return i
} }
func (self *IconPool) Init() { func (self *IconPool) Init() {
files, err := ioutil.ReadDir(self.GameShellIconPath) files, err := ioutil.ReadDir(self.GameShellIconPath)
if err != nil { if err != nil {
@@ -56,5 +54,5 @@ func (self *IconPool) GetImgSurf(keyname string) *sdl.Surface {
} }
var MyIconPool *IconPool var MyIconPool *IconPool
// = NewIconPool()
// = NewIconPool()

View File

@@ -3,10 +3,10 @@ package UI
import ( import (
"github.com/veandco/go-sdl2/ttf" "github.com/veandco/go-sdl2/ttf"
"github.com/cuu/gogame/draw"
"github.com/cuu/gogame/color" "github.com/cuu/gogame/color"
"github.com/cuu/gogame/draw"
) )
var DefaultInfoPageListItemHeight = 30 var DefaultInfoPageListItemHeight = 30
type InfoPageListItem struct { type InfoPageListItem struct {
@@ -71,4 +71,3 @@ func (self *InfoPageListItem) Draw() {
draw.Line(canvas_, &color.Color{169, 169, 169, 255}, self.PosX, self.PosY+self.Height-1, self.PosX+self.Width, self.PosY+self.Height-1, 1) draw.Line(canvas_, &color.Color{169, 169, 169, 255}, self.PosX, self.PosY+self.Height-1, self.PosX+self.Width, self.PosY+self.Height-1, 1)
} }

View File

@@ -6,10 +6,9 @@ import (
// "github.com/cuu/gogame/surface" // "github.com/cuu/gogame/surface"
// "github.com/cuu/gogame/event" // "github.com/cuu/gogame/event"
"github.com/cuu/gogame/rect"
"github.com/cuu/gogame/color" "github.com/cuu/gogame/color"
"github.com/cuu/gogame/draw" "github.com/cuu/gogame/draw"
"github.com/cuu/gogame/rect"
) )
type InfoPageSelector struct { type InfoPageSelector struct {
@@ -39,7 +38,6 @@ func (self *InfoPageSelector) Draw() {
_, y := mylist[idx].Coord() _, y := mylist[idx].Coord()
_, h := mylist[idx].Size() _, h := mylist[idx].Size()
self.PosY = y + 1 self.PosY = y + 1
self.Height = h - 3 self.Height = h - 3
@@ -49,5 +47,3 @@ func (self *InfoPageSelector) Draw() {
draw.AARoundRect(canvas_, &rect_, self.BackgroundColor, 4, 0, self.BackgroundColor) draw.AARoundRect(canvas_, &rect_, self.BackgroundColor, 4, 0, self.BackgroundColor)
} }
} }

View File

@@ -4,16 +4,15 @@ import (
"fmt" "fmt"
"strings" "strings"
"github.com/cuu/gogame/font"
"github.com/cuu/gogame/draw"
"github.com/cuu/gogame/surface"
"github.com/cuu/gogame/color" "github.com/cuu/gogame/color"
"github.com/cuu/gogame/draw"
"github.com/cuu/gogame/event" "github.com/cuu/gogame/event"
"github.com/cuu/gogame/font"
"github.com/cuu/gogame/surface"
"github.com/clockworkpi/LauncherGoDev/sysgo/easings" "github.com/clockworkpi/LauncherGoDev/sysgo/easings"
) )
//sysgo/UI/keyboard_keys.layout //sysgo/UI/keyboard_keys.layout
type KeyboardIcon struct { type KeyboardIcon struct {
TextItem // IconItem->TextItem->KeyboardIcon TextItem // IconItem->TextItem->KeyboardIcon
@@ -37,13 +36,11 @@ func (self *KeyboardIcon) Draw() {
} }
type KeyboardSelector struct { type KeyboardSelector struct {
PageSelector PageSelector
Parent *Keyboard Parent *Keyboard
} }
func NewKeyboardSelector() *KeyboardSelector { func NewKeyboardSelector() *KeyboardSelector {
p := &KeyboardSelector{} p := &KeyboardSelector{}
@@ -118,14 +115,12 @@ func NewKeyboard() *Keyboard {
p.KeyboardLayoutFile = "sysgo/UI/keyboard_keys.layout" p.KeyboardLayoutFile = "sysgo/UI/keyboard_keys.layout"
return p return p
} }
func (self *Keyboard) ReadLayoutFile(fname string) { func (self *Keyboard) ReadLayoutFile(fname string) {
LayoutIndex := 0 LayoutIndex := 0
content, err := ReadLines(fname) content, err := ReadLines(fname)
@@ -162,7 +157,6 @@ func (self *Keyboard) ReadLayoutFile( fname string) {
} }
} }
func (self *Keyboard) SetPassword(pwd string) { func (self *Keyboard) SetPassword(pwd string) {
pwd_seq_list := strings.SplitAfter(pwd, "") pwd_seq_list := strings.SplitAfter(pwd, "")
@@ -172,7 +166,6 @@ func (self *Keyboard) SetPassword(pwd string) {
} }
} }
func (self *Keyboard) Init() { func (self *Keyboard) Init() {
self.CanvasHWND = self.Screen.CanvasHWND self.CanvasHWND = self.Screen.CanvasHWND
self.ReadLayoutFile(self.KeyboardLayoutFile) //assign to self.Secs self.ReadLayoutFile(self.KeyboardLayoutFile) //assign to self.Secs
@@ -415,7 +408,6 @@ func (self *Keyboard) ShiftKeyboardPage() {
self.Screen.SwapAndShow() self.Screen.SwapAndShow()
} }
func (self *Keyboard) KeyDown(ev *event.Event) { func (self *Keyboard) KeyDown(ev *event.Event) {
if ev.Data["Key"] == CurKeys["Up"] { if ev.Data["Key"] == CurKeys["Up"] {
self.SelectUpChar() self.SelectUpChar()

View File

@@ -4,13 +4,11 @@ import (
"github.com/clockworkpi/LauncherGoDev/sysgo" "github.com/clockworkpi/LauncherGoDev/sysgo"
) )
var CurKeys map[string]string var CurKeys map[string]string
var GameShell map[string]string var GameShell map[string]string
var PC map[string]string var PC map[string]string
func DefinePC() { func DefinePC() {
PC["Up"] = "Up" PC["Up"] = "Up"
PC["Down"] = "Down" PC["Down"] = "Down"
@@ -54,7 +52,6 @@ func DefineGameShell() {
} }
func keys_def_init() { func keys_def_init() {
GameShell = make(map[string]string) GameShell = make(map[string]string)
PC = make(map[string]string) PC = make(map[string]string)

View File

@@ -5,12 +5,11 @@ import (
"github.com/veandco/go-sdl2/sdl" "github.com/veandco/go-sdl2/sdl"
"github.com/veandco/go-sdl2/ttf" "github.com/veandco/go-sdl2/ttf"
"github.com/cuu/gogame/surface"
"github.com/cuu/gogame/rect"
"github.com/cuu/gogame/color" "github.com/cuu/gogame/color"
"github.com/cuu/gogame/font"
"github.com/cuu/gogame/draw" "github.com/cuu/gogame/draw"
"github.com/cuu/gogame/font"
"github.com/cuu/gogame/rect"
"github.com/cuu/gogame/surface"
) )
type LabelInterface interface { type LabelInterface interface {
@@ -50,7 +49,6 @@ func (self *Label) Init(text string, font_obj *ttf.Font,col *color.Color ) {
self.Color = col self.Color = col
} }
self.Text = text self.Text = text
self.FontObj = font_obj self.FontObj = font_obj
@@ -87,7 +85,6 @@ func (self *Label) GetText() string {
return self.Text return self.Text
} }
func (self *Label) SetText(text string) { func (self *Label) SetText(text string) {
self.Text = text self.Text = text
self.Width, self.Height = font.Size(self.FontObj, self.Text) self.Width, self.Height = font.Size(self.FontObj, self.Text)

View File

@@ -2,15 +2,13 @@ package UI
import ( import (
"fmt" "fmt"
"strings" "github.com/go-ini/ini"
"github.com/veandco/go-sdl2/ttf"
"io/ioutil" "io/ioutil"
"path/filepath" "path/filepath"
"github.com/veandco/go-sdl2/ttf" "strings"
"github.com/go-ini/ini"
) )
func sliceToInt(s []int) int { func sliceToInt(s []int) int {
res := 0 res := 0
op := 1 op := 1
@@ -21,7 +19,6 @@ func sliceToInt(s []int) int {
return res return res
} }
func ParseNum(s string) []int { func ParseNum(s string) []int {
nLen := 0 nLen := 0
for i := 0; i < len(s); i++ { for i := 0; i < len(s); i++ {
@@ -46,7 +43,6 @@ func GetNumberFromString(s string) int {
} }
type LangManager struct { type LangManager struct {
Langs map[string]string Langs map[string]string
ConfigFilename string ConfigFilename string

View File

@@ -3,13 +3,11 @@ package UI
import ( import (
"github.com/veandco/go-sdl2/ttf" "github.com/veandco/go-sdl2/ttf"
"github.com/cuu/gogame/draw"
"github.com/cuu/gogame/color" "github.com/cuu/gogame/color"
"github.com/cuu/gogame/draw"
) )
type ListItemInterface interface { type ListItemInterface interface {
Init(text string) Init(text string)
Size() (int, int) Size() (int, int)
@@ -19,7 +17,6 @@ type ListItemInterface interface {
GetLinkObj() PluginInterface GetLinkObj() PluginInterface
Draw() Draw()
} }
type ListItem struct { type ListItem struct {
@@ -45,7 +42,6 @@ func NewListItem() *ListItem {
return i return i
} }
func (self *ListItem) Init(text string) { func (self *ListItem) Init(text string) {
l := NewLabel() l := NewLabel()
l.PosX = 16 l.PosX = 16
@@ -55,7 +51,6 @@ func (self *ListItem) Init(text string) {
} }
func (self *ListItem) Coord() (int, int) { func (self *ListItem) Coord() (int, int) {
return self.PosX, self.PosY return self.PosX, self.PosY
} }
@@ -64,7 +59,6 @@ func (self *ListItem) Size() (int,int) {
return self.Width, self.Height return self.Width, self.Height
} }
func (self *ListItem) GetLinkObj() PluginInterface { func (self *ListItem) GetLinkObj() PluginInterface {
return self.LinkObj return self.LinkObj
} }
@@ -76,10 +70,8 @@ func (self *ListItem) Draw() {
self.Labels["Text"].NewCoord(x_, self.PosY+(self.Height-h_)/2) self.Labels["Text"].NewCoord(x_, self.PosY+(self.Height-h_)/2)
self.Labels["Text"].Draw() self.Labels["Text"].Draw()
draw.Line(self.Parent.GetCanvasHWND(), &color.Color{169, 169, 169, 255}, draw.Line(self.Parent.GetCanvasHWND(), &color.Color{169, 169, 169, 255},
self.PosX, (self.PosY + self.Height - 1), self.PosX, (self.PosY + self.Height - 1),
(self.PosX + self.Width), (self.PosY + self.Height - 1), 1) (self.PosX + self.Width), (self.PosY + self.Height - 1), 1)
} }

View File

@@ -3,26 +3,27 @@ package UI
import ( import (
"fmt" "fmt"
"io/ioutil" "io/ioutil"
"strings"
"log" "log"
"strings"
//"encoding/json" //"encoding/json"
"path/filepath"
gotime "time"
"github.com/veandco/go-sdl2/sdl" "github.com/veandco/go-sdl2/sdl"
"github.com/veandco/go-sdl2/ttf" "github.com/veandco/go-sdl2/ttf"
"path/filepath"
gotime "time"
"github.com/cuu/gogame/display"
"github.com/cuu/gogame/surface"
"github.com/cuu/gogame/draw"
"github.com/cuu/gogame/color" "github.com/cuu/gogame/color"
"github.com/cuu/gogame/rect" "github.com/cuu/gogame/display"
"github.com/cuu/gogame/draw"
"github.com/cuu/gogame/font" "github.com/cuu/gogame/font"
"github.com/cuu/gogame/rect"
"github.com/cuu/gogame/surface"
"github.com/cuu/gogame/time" "github.com/cuu/gogame/time"
"github.com/cuu/gogame/event" "github.com/cuu/gogame/event"
"github.com/clockworkpi/LauncherGoDev/sysgo" "github.com/clockworkpi/LauncherGoDev/sysgo"
) )
//eg: MainScreen //eg: MainScreen
type ScreenInterface interface { type ScreenInterface interface {
AppendPage(pg PageInterface) AppendPage(pg PageInterface)
@@ -48,7 +49,6 @@ type ScreenInterface interface {
type PluginConfig struct { type PluginConfig struct {
NAME string `json:"NAME"` // plugin name,default could be the same as Plugin Folder's name NAME string `json:"NAME"` // plugin name,default could be the same as Plugin Folder's name
SO_FILE string `json:"SO_FILE"` SO_FILE string `json:"SO_FILE"`
} }
type MessageBox struct { type MessageBox struct {
@@ -155,7 +155,6 @@ func (self *MessageBox) Draw() {
} }
} }
type MainScreen struct { type MainScreen struct {
@@ -184,7 +183,6 @@ type MainScreen struct {
LastKeyDown gotime.Time LastKeyDown gotime.Time
} }
func NewMainScreen() *MainScreen { func NewMainScreen() *MainScreen {
m := &MainScreen{} m := &MainScreen{}
@@ -237,8 +235,6 @@ func (self *MainScreen) FartherPages() { // right after ReadTheDirIntoPages
self.CurrentPage.SetOnShow(true) self.CurrentPage.SetOnShow(true)
} }
func (self *MainScreen) CurPage() PageInterface { func (self *MainScreen) CurPage() PageInterface {
return self.CurrentPage return self.CurrentPage
} }
@@ -286,7 +282,6 @@ func (self *MainScreen) ExtraName(name string) string {
} }
} }
//ExecPackage is all-in-one folder ,Name.sh,Name.png,etc //ExecPackage is all-in-one folder ,Name.sh,Name.png,etc
func (self *MainScreen) IsExecPackage(dirname string) bool { func (self *MainScreen) IsExecPackage(dirname string) bool {
files, err := ioutil.ReadDir(dirname) files, err := ioutil.ReadDir(dirname)
@@ -366,7 +361,6 @@ func (self *MainScreen) GetWirelessIP() string {
cli := fmt.Sprintf("ip -4 addr show %s | grep -oP '(?<=inet\\s)\\d+(\\.\\d+){3}'", sysgo.WifiDev) cli := fmt.Sprintf("ip -4 addr show %s | grep -oP '(?<=inet\\s)\\d+(\\.\\d+){3}'", sysgo.WifiDev)
out := SystemTrim(cli) out := SystemTrim(cli)
return out return out
} }
@@ -374,7 +368,6 @@ func (self *MainScreen) RunEXE( cmdpath string) {
self.DrawRun() self.DrawRun()
self.SwapAndShow() self.SwapAndShow()
time.BlockDelay(1000) time.BlockDelay(1000)
cmdpath = strings.Trim(cmdpath, " ") cmdpath = strings.Trim(cmdpath, " ")
@@ -406,7 +399,6 @@ func (self *MainScreen) KeyDown(ev *event.Event) {
} }
func (self *MainScreen) DrawRun() { func (self *MainScreen) DrawRun() {
self.MsgBox.SetText("Launching....") self.MsgBox.SetText("Launching....")
self.MsgBox.Draw() self.MsgBox.Draw()

View File

@@ -2,19 +2,17 @@ package UI
import ( import (
"fmt" "fmt"
"github.com/cuu/gogame/surface"
"github.com/cuu/gogame/image"
"github.com/cuu/gogame/draw" "github.com/cuu/gogame/draw"
"github.com/cuu/gogame/image"
"github.com/cuu/gogame/rect" "github.com/cuu/gogame/rect"
"github.com/cuu/gogame/surface"
) )
type MultiIconItem struct { type MultiIconItem struct {
IconItem IconItem
IconWidth int IconWidth int
IconHeight int IconHeight int
} }
func NewMultiIconItem() *MultiIconItem { func NewMultiIconItem() *MultiIconItem {

View File

@@ -6,10 +6,10 @@ import (
"github.com/veandco/go-sdl2/sdl" "github.com/veandco/go-sdl2/sdl"
"github.com/veandco/go-sdl2/ttf" "github.com/veandco/go-sdl2/ttf"
"github.com/cuu/gogame/surface"
"github.com/cuu/gogame/rect"
"github.com/cuu/gogame/color" "github.com/cuu/gogame/color"
"github.com/cuu/gogame/font" "github.com/cuu/gogame/font"
"github.com/cuu/gogame/rect"
"github.com/cuu/gogame/surface"
) )
//MultiLabel is also a LabelInterface //MultiLabel is also a LabelInterface
@@ -50,7 +50,6 @@ func (self *MultiLabel) SetCanvasHWND( canvas *sdl.Surface) {
self.CanvasHWND = canvas self.CanvasHWND = canvas
} }
func (self *MultiLabel) SetColor(col *color.Color) { func (self *MultiLabel) SetColor(col *color.Color) {
if col != nil { if col != nil {
self.Color = col self.Color = col
@@ -61,7 +60,6 @@ func (self *MultiLabel) GetText() string {
return self.Text return self.Text
} }
func (self *MultiLabel) SetText(text string) { func (self *MultiLabel) SetText(text string) {
self.Text = text self.Text = text
@@ -137,4 +135,3 @@ func (self *MultiLabel) blit_text(surf *sdl.Surface,text string, pos_x,pos_y int
self.Height = lines self.Height = lines
} }

View File

@@ -9,15 +9,14 @@ import (
"github.com/veandco/go-sdl2/sdl" "github.com/veandco/go-sdl2/sdl"
"github.com/cuu/gogame/surface"
"github.com/cuu/gogame/draw" "github.com/cuu/gogame/draw"
"github.com/cuu/gogame/surface"
// "github.com/cuu/gogame/rect" // "github.com/cuu/gogame/rect"
// "github.com/cuu/gogame/font" // "github.com/cuu/gogame/font"
"github.com/cuu/gogame/event" "github.com/cuu/gogame/event"
"github.com/cuu/gogame/transform"
"github.com/clockworkpi/LauncherGoDev/sysgo/easings" "github.com/clockworkpi/LauncherGoDev/sysgo/easings"
"github.com/cuu/gogame/transform"
) )
type element struct { type element struct {
@@ -68,7 +67,6 @@ func NewPageStack() *PageStack {
return stk return stk
} }
type PageSelectorInterface interface { type PageSelectorInterface interface {
Init(x, y, w, h, alpha int) Init(x, y, w, h, alpha int)
Adjust(x, y, w, h, alpha int) Adjust(x, y, w, h, alpha int)
@@ -148,7 +146,6 @@ func (self *PageSelector) Draw() {
} }
} }
type PageInterface interface { type PageInterface interface {
// ## shared functions ## // ## shared functions ##
Adjust() Adjust()
@@ -178,7 +175,6 @@ type PageInterface interface {
ScrollUp() ScrollUp()
ScrollDown() ScrollDown()
SetIconIndex(idx int) SetIconIndex(idx int)
GetIconIndex() int GetIconIndex() int
@@ -187,11 +183,9 @@ type PageInterface interface {
Size() (int, int) Size() (int, int)
NewSize(w, h int) NewSize(w, h int)
UpdateIconNumbers() UpdateIconNumbers()
GetIconNumbers() int GetIconNumbers() int
SetOnShow(on_show bool) SetOnShow(on_show bool)
GetOnShow() bool GetOnShow() bool
@@ -220,8 +214,6 @@ type PageInterface interface {
ClearCanvas() ClearCanvas()
Draw() Draw()
} }
type Page struct { type Page struct {
@@ -276,7 +268,6 @@ func (self *Page) SetScreen(main_screen *MainScreen) {
self.Screen = main_screen self.Screen = main_screen
} }
func (self *Page) AdjustHLeftAlign() { func (self *Page) AdjustHLeftAlign() {
self.PosX = self.Index * self.Screen.Width self.PosX = self.Index * self.Screen.Width
self.Width = self.Screen.Width self.Width = self.Screen.Width
@@ -354,7 +345,6 @@ func (self *Page) AdjustSLeftAlign() { // ## adjust coordinator and append the P
} }
} }
func (self *Page) AdjustSAutoLeftAlign() { // ## adjust coordinator and append the PageSelector func (self *Page) AdjustSAutoLeftAlign() { // ## adjust coordinator and append the PageSelector
self.PosX = self.Index * self.Screen.Width self.PosX = self.Index * self.Screen.Width
self.Width = self.Screen.Width self.Width = self.Screen.Width
@@ -423,8 +413,6 @@ func (self *Page) AdjustSAutoLeftAlign() { // ## adjust coordinator and append
} }
} }
func (self *Page) InitLeftAlign() { func (self *Page) InitLeftAlign() {
self.PosX = self.Index * self.Screen.Width self.PosX = self.Index * self.Screen.Width
self.Width = self.Screen.Width self.Width = self.Screen.Width
@@ -574,7 +562,6 @@ func (self *Page) Init() {
} }
} }
func (self *Page) IconStepMoveData(icon_eh, cuts int) []int { // no Sine,No curve,plain movement steps data func (self *Page) IconStepMoveData(icon_eh, cuts int) []int { // no Sine,No curve,plain movement steps data
var all_pieces []int var all_pieces []int
@@ -656,7 +643,6 @@ func (self *Page) EasingData(start,distance int) []int {
return all_last_posx return all_last_posx
} }
func (self *Page) IconSmoothUp(icon_ew int) { func (self *Page) IconSmoothUp(icon_ew int) {
data := self.EasingData(self.PosX, icon_ew) data := self.EasingData(self.PosX, icon_ew)
data2 := self.IconStepMoveData(self.SelectedIconTopOffset, len(data)) data2 := self.IconStepMoveData(self.SelectedIconTopOffset, len(data))
@@ -698,7 +684,6 @@ func (self *Page) IconsEasingLeft(icon_ew int) {
} }
} }
func (self *Page) IconsEasingRight(icon_ew int) { func (self *Page) IconsEasingRight(icon_ew int) {
data := self.EasingData(self.PosX, icon_ew) data := self.EasingData(self.PosX, icon_ew)
data2 := self.IconStepMoveData(self.SelectedIconTopOffset, len(data)) data2 := self.IconStepMoveData(self.SelectedIconTopOffset, len(data))
@@ -730,7 +715,6 @@ func (self *Page) EasingLeft(ew int) {
} }
} }
func (self *Page) EasingRight(ew int) { func (self *Page) EasingRight(ew int) {
data := self.EasingData(self.PosX, ew) data := self.EasingData(self.PosX, ew)
@@ -785,7 +769,6 @@ func (self *Page) MoveIconIndexNext() bool {
return true return true
} }
func (self *Page) IconClick() { func (self *Page) IconClick() {
if self.IconIndex > (len(self.Icons) - 1) { if self.IconIndex > (len(self.Icons) - 1) {
return return
@@ -922,7 +905,6 @@ func (self *Page) KeyDown( ev *event.Event) {
} }
func (self *Page) OnLoadCb() { func (self *Page) OnLoadCb() {
} }
@@ -953,7 +935,6 @@ func (self *Page) SetFootMsg(footmsg [5]string) {
self.FootMsg = footmsg self.FootMsg = footmsg
} }
func (self *Page) GetCanvasHWND() *sdl.Surface { func (self *Page) GetCanvasHWND() *sdl.Surface {
return self.CanvasHWND return self.CanvasHWND
} }
@@ -962,7 +943,6 @@ func (self *Page) SetCanvasHWND( canvas *sdl.Surface) {
self.CanvasHWND = canvas self.CanvasHWND = canvas
} }
func (self *Page) GetHWND() *sdl.Surface { func (self *Page) GetHWND() *sdl.Surface {
return self.HWND return self.HWND
} }
@@ -987,7 +967,6 @@ func (self *Page) GetIconIndex() int {
return self.IconIndex return self.IconIndex
} }
func (self *Page) GetName() string { func (self *Page) GetName() string {
return self.Name return self.Name
} }
@@ -1068,8 +1047,6 @@ func (self *Page) ScrollDown() {
} }
} }
func (self *Page) FastScrollUp(step int) { func (self *Page) FastScrollUp(step int) {
if len(self.MyList) == 0 { if len(self.MyList) == 0 {
return return
@@ -1128,4 +1105,3 @@ func (self *Page) FastScrollDown(step int) {
// self.Scrolled -=1 // self.Scrolled -=1
} }
} }

View File

@@ -25,12 +25,10 @@ func (self *Plugin) Init( screen *MainScreen) {
} }
func (self *Plugin) Run(screen *MainScreen) { func (self *Plugin) Run(screen *MainScreen) {
} }
func NewPluginPool() map[string]PluginInterface { func NewPluginPool() map[string]PluginInterface {
pp := make(map[string]PluginInterface) pp := make(map[string]PluginInterface)
return pp return pp

View File

@@ -27,7 +27,6 @@ type ListScroller struct{
CanvasHWND *sdl.Surface CanvasHWND *sdl.Surface
} }
func NewListScroller() *ListScroller { func NewListScroller() *ListScroller {
l := &ListScroller{} l := &ListScroller{}
l.Width = 7 l.Width = 7

View File

@@ -1,12 +1,11 @@
package UI package UI
import ( import (
"fmt" "fmt"
"log" "log"
"strings"
"strconv" "strconv"
"strings"
"github.com/go-ini/ini" "github.com/go-ini/ini"
@@ -17,7 +16,6 @@ import (
type SkinManager struct { type SkinManager struct {
Colors map[string]*color.Color Colors map[string]*color.Color
} }
func NewSkinManager() *SkinManager { func NewSkinManager() *SkinManager {
@@ -26,7 +24,6 @@ func NewSkinManager() *SkinManager {
return s return s
} }
func (self *SkinManager) ConvertToRGB(hexstr string) *color.Color { func (self *SkinManager) ConvertToRGB(hexstr string) *color.Color {
if len(hexstr) < 7 || string(hexstr[0]) != "#" { // # 00 00 00 if len(hexstr) < 7 || string(hexstr[0]) != "#" { // # 00 00 00
log.Fatalf("ConvertToRGB hex string format error %s", hexstr) log.Fatalf("ConvertToRGB hex string format error %s", hexstr)
@@ -89,7 +86,6 @@ func (self *SkinManager) Init() {
} }
} }
func (self *SkinManager) GiveColor(name string) *color.Color { func (self *SkinManager) GiveColor(name string) *color.Color {
if val, ok := self.Colors[name]; ok { if val, ok := self.Colors[name]; ok {

View File

@@ -12,10 +12,8 @@ import (
//"github.com/cuu/gogame/rect" //"github.com/cuu/gogame/rect"
//"github.com/cuu/gogame/font" //"github.com/cuu/gogame/font"
"github.com/cuu/gogame/event" "github.com/cuu/gogame/event"
//"github.com/cuu/gogame/transform" //"github.com/cuu/gogame/transform"
//"github.com/clockworkpi/LauncherGoDev/sysgo/easings" //"github.com/clockworkpi/LauncherGoDev/sysgo/easings"
) )
type SliderInterface interface { type SliderInterface interface {

View File

@@ -3,11 +3,10 @@ package UI
import ( import (
"log" "log"
"github.com/itchyny/volume-go"
"github.com/cuu/gogame/draw" "github.com/cuu/gogame/draw"
"github.com/cuu/gogame/rect" "github.com/cuu/gogame/rect"
"github.com/itchyny/volume-go"
//"github.com/cuu/gogame/color" //"github.com/cuu/gogame/color"
) )
type SoundPatch struct { type SoundPatch struct {
@@ -37,11 +36,9 @@ func NewSoundPatch() *SoundPatch {
[2]int{51, 60}, [2]int{61, 70}, [2]int{71, 85}, [2]int{51, 60}, [2]int{61, 70}, [2]int{71, 85},
[2]int{86, 90}, [2]int{91, 95}, [2]int{96, 100}} [2]int{86, 90}, [2]int{91, 95}, [2]int{96, 100}}
return p return p
} }
func (self *SoundPatch) Init() { func (self *SoundPatch) Init() {
self.SetCanvasHWND(self.Parent.CanvasHWND) self.SetCanvasHWND(self.Parent.CanvasHWND)
} }
@@ -121,4 +118,3 @@ func (self *SoundPatch) Draw() {
draw.AARoundRect(self.CanvasHWND, &vol_rect, MySkinManager.GiveColor("Front"), 3, 0, MySkinManager.GiveColor("Front")) draw.AARoundRect(self.CanvasHWND, &vol_rect, MySkinManager.GiveColor("Front"), 3, 0, MySkinManager.GiveColor("Front"))
} }
} }

View File

@@ -1,27 +1,22 @@
package UI package UI
import ( import (
"github.com/veandco/go-sdl2/ttf" "github.com/veandco/go-sdl2/ttf"
"github.com/cuu/gogame/surface"
"github.com/cuu/gogame/color" "github.com/cuu/gogame/color"
"github.com/cuu/gogame/font"
"github.com/cuu/gogame/draw" "github.com/cuu/gogame/draw"
"github.com/cuu/gogame/font"
"github.com/cuu/gogame/surface"
) )
type TextItemInterface interface { type TextItemInterface interface {
IconItemInterface IconItemInterface
GetBold() bool GetBold() bool
SetBold(bold bool) SetBold(bold bool)
GetStr() string GetStr() string
} }
type TextItem struct { type TextItem struct {
IconItem IconItem
Str string Str string
@@ -67,7 +62,6 @@ func (self *TextItem) Draw() {
self.Height = surface.GetHeight(my_text) self.Height = surface.GetHeight(my_text)
} }
rect_ := draw.MidRect(self.PosX, self.PosY, self.Width, self.Height, Width, Height) rect_ := draw.MidRect(self.PosX, self.PosY, self.Width, self.Height, Width, Height)
surface.Blit(self.Parent.GetCanvasHWND(), my_text, rect_, nil) surface.Blit(self.Parent.GetCanvasHWND(), my_text, rect_, nil)
my_text.Free() my_text.Free()

View File

@@ -7,11 +7,11 @@ import (
"github.com/veandco/go-sdl2/sdl" "github.com/veandco/go-sdl2/sdl"
"github.com/veandco/go-sdl2/ttf" "github.com/veandco/go-sdl2/ttf"
"github.com/cuu/gogame/surface"
"github.com/cuu/gogame/color" "github.com/cuu/gogame/color"
"github.com/cuu/gogame/draw" "github.com/cuu/gogame/draw"
"github.com/cuu/gogame/font" "github.com/cuu/gogame/font"
"github.com/cuu/gogame/rect" "github.com/cuu/gogame/rect"
"github.com/cuu/gogame/surface"
) )
type Textarea struct { type Textarea struct {
@@ -77,7 +77,6 @@ func (self *Textarea) RemoveFromLastText() []string {
return self.MyWords return self.MyWords
} }
func (self *Textarea) AppendText(alphabet string) { func (self *Textarea) AppendText(alphabet string) {
self.AppendAndBlitText(alphabet) self.AppendAndBlitText(alphabet)
} }
@@ -109,7 +108,6 @@ func (self *Textarea) BuildBlitText() {
linenumber := 0 linenumber := 0
cursor_row := 0 cursor_row := 0
for i, v := range self.MyWords { for i, v := range self.MyWords {
t := font.Render(self.FontObj, v, true, &color.Color{8, 135, 174, 255}, nil) t := font.Render(self.FontObj, v, true, &color.Color{8, 135, 174, 255}, nil)
t_width := surface.GetWidth(t) t_width := surface.GetWidth(t)

View File

@@ -1,33 +1,30 @@
package UI package UI
import ( import (
"fmt"
"os"
"log"
"strconv"
"bufio" "bufio"
"strings" "fmt"
"os/exec"
"io/ioutil" "io/ioutil"
"log"
"os"
"os/exec"
"strconv"
"strings"
gotime "time" gotime "time"
"github.com/veandco/go-sdl2/sdl" "github.com/veandco/go-sdl2/sdl"
"github.com/veandco/go-sdl2/ttf" "github.com/veandco/go-sdl2/ttf"
"github.com/cuu/gogame/surface"
"github.com/cuu/gogame/rect"
"github.com/cuu/gogame/font"
"github.com/cuu/gogame/draw" "github.com/cuu/gogame/draw"
"github.com/cuu/gogame/font"
"github.com/cuu/gogame/rect"
"github.com/cuu/gogame/surface"
"github.com/itchyny/volume-go" "github.com/itchyny/volume-go"
"github.com/vjeantet/jodaTime" "github.com/vjeantet/jodaTime"
"github.com/clockworkpi/LauncherGoDev/sysgo" "github.com/clockworkpi/LauncherGoDev/sysgo"
) )
var TitleBar_BarHeight = 24 var TitleBar_BarHeight = 24
type TitleBarIconItem struct { type TitleBarIconItem struct {
@@ -86,7 +83,6 @@ func (self *TitleBarIconItem) Draw() {
} }
} }
type TitleBar struct { type TitleBar struct {
Widget Widget
BarHeight int BarHeight int
@@ -113,7 +109,6 @@ type TitleBar struct {
TimeFont *ttf.Font TimeFont *ttf.Font
} }
func NewTitleBar() *TitleBar { func NewTitleBar() *TitleBar {
t := &TitleBar{} t := &TitleBar{}
@@ -172,7 +167,7 @@ func (self *TitleBar) RoundRobinCheck() {
func (self *TitleBar) IsWifiConnectedNow() bool { func (self *TitleBar) IsWifiConnectedNow() bool {
cli := fmt.Sprintf("ip -4 addr show %s | grep -oP '(?<=inet\\s)\\d+(\\.\\d+){3}'", sysgo.WifiDev) cli := fmt.Sprintf("ip -4 addr show %s | grep -oP '(?<=inet\\s)\\d+(\\.\\d+){3}'", sysgo.WifiDev)
out := System(cli) out := System(cli)
if(len(out) > 7) { if len(out) > 7 {
if strings.Contains(out, "not") { if strings.Contains(out, "not") {
return false return false
} else { } else {
@@ -192,7 +187,7 @@ func (t *TitleBar) GetWifiStrength() int {
qua := 0 qua := 0
cli := fmt.Sprintf("iwconfig %s | grep Signal | /usr/bin/awk '{print $4}' | /usr/bin/cut -d'=' -f2", sysgo.WifiDev) cli := fmt.Sprintf("iwconfig %s | grep Signal | /usr/bin/awk '{print $4}' | /usr/bin/cut -d'=' -f2", sysgo.WifiDev)
out := System(cli) out := System(cli)
if(len(out) > 2) { if len(out) > 2 {
if strings.Contains(out, "No") == false { if strings.Contains(out, "No") == false {
out = strings.TrimSuffix(out, "\n") out = strings.TrimSuffix(out, "\n")
stren, err := strconv.ParseInt(out, 10, 0) stren, err := strconv.ParseInt(out, 10, 0)
@@ -410,7 +405,6 @@ func (self *TitleBar) Init(main_screen *MainScreen) {
self.Icons["bluetooth"] = bluetooth self.Icons["bluetooth"] = bluetooth
self.CheckBluetooth() self.CheckBluetooth()
round_corners := NewTitleBarIconItem() round_corners := NewTitleBarIconItem()
round_corners.IconWidth = 10 round_corners.IconWidth = 10
round_corners.IconHeight = 10 round_corners.IconHeight = 10
@@ -458,7 +452,6 @@ func (self *TitleBar) ClearCanvas() {
} }
func (self *TitleBar) UpdateTimeLocation() { func (self *TitleBar) UpdateTimeLocation() {
d, err := ioutil.ReadFile("/etc/localtime") d, err := ioutil.ReadFile("/etc/localtime")
@@ -481,7 +474,6 @@ func (self *TitleBar) GetLocalTime() gotime.Time {
} }
} }
func (self *TitleBar) Draw(title string) { func (self *TitleBar) Draw(title string) {
self.ClearCanvas() self.ClearCanvas()
self.Title = title self.Title = title
@@ -540,6 +532,3 @@ func (self *TitleBar) Draw(title string) {
surface.Blit(self.HWND, self.CanvasHWND, &rect_, nil) surface.Blit(self.HWND, self.CanvasHWND, &rect_, nil)
} }
} }

View File

@@ -6,14 +6,13 @@ import (
"github.com/veandco/go-sdl2/sdl" "github.com/veandco/go-sdl2/sdl"
"github.com/veandco/go-sdl2/ttf" "github.com/veandco/go-sdl2/ttf"
"github.com/cuu/gogame/surface"
"github.com/cuu/gogame/draw"
"github.com/cuu/gogame/color" "github.com/cuu/gogame/color"
"github.com/cuu/gogame/image" "github.com/cuu/gogame/draw"
"github.com/cuu/gogame/font" "github.com/cuu/gogame/font"
"github.com/cuu/gogame/image"
"github.com/cuu/gogame/surface"
) )
type UntitledIcon struct { type UntitledIcon struct {
Widget Widget
Words []string Words []string
@@ -67,6 +66,3 @@ func (self *UntitledIcon) Surface() *sdl.Surface {
self.Draw() self.Draw()
return self.BG return self.BG
} }

View File

@@ -1,18 +1,18 @@
package UI package UI
import ( import (
"os"
"log"
"path/filepath"
"strings"
"fmt"
"bufio" "bufio"
"bytes" "bytes"
"fmt"
"io" "io"
"strconv" "log"
"syscall" "os"
"os/exec" "os/exec"
"path/filepath"
"runtime" "runtime"
"strconv"
"strings"
"syscall"
"github.com/cuu/gogame/display" "github.com/cuu/gogame/display"
@@ -42,7 +42,6 @@ func Abs(n int) int {
return (n ^ y) - y return (n ^ y) - y
} }
func SkinMap(orig_file_or_dir string) string { func SkinMap(orig_file_or_dir string) string {
DefaultSkin := "skin/default/" DefaultSkin := "skin/default/"
ret := "" ret := ""
@@ -91,7 +90,6 @@ func IsDirectory(path string) bool {
} }
} }
func IsAFile(path string) bool { func IsAFile(path string) bool {
fileInfo, err := os.Stat(path) fileInfo, err := os.Stat(path)
if err != nil { if err != nil {
@@ -101,7 +99,6 @@ func IsAFile(path string) bool {
} }
} }
func MakeExecutable(path string) { func MakeExecutable(path string) {
fileInfo, err := os.Stat(path) fileInfo, err := os.Stat(path)
if err != nil { if err != nil {
@@ -185,7 +182,6 @@ func WriteLines(lines [] string,path string)(err error){
return return
} }
func GetGid(path string) int { func GetGid(path string) int {
s, err := os.Stat(path) s, err := os.Stat(path)
if err != nil { if err != nil {
@@ -200,7 +196,6 @@ func GetGid(path string) int {
return int(sys_interface.(*syscall.Stat_t).Gid) return int(sys_interface.(*syscall.Stat_t).Gid)
} }
func GetUid(path string) int { func GetUid(path string) int {
s, err := os.Stat(path) s, err := os.Stat(path)
if err != nil { if err != nil {
@@ -242,9 +237,6 @@ func CheckBattery() int {
return 0 return 0
} }
func System(cmd string) string { func System(cmd string) string {
ret := "" ret := ""
out, err := exec.Command("bash", "-c", cmd).Output() out, err := exec.Command("bash", "-c", cmd).Output()

View File

@@ -2,9 +2,8 @@ package sysgo
import ( import (
"fmt" "fmt"
"os"
"github.com/go-ini/ini" "github.com/go-ini/ini"
"os"
) )
type PowerLevel struct { type PowerLevel struct {
@@ -33,10 +32,8 @@ var (
CurPowerLevel = "performance" CurPowerLevel = "performance"
Lang = "English" Lang = "English"
WifiDev = "wlan0" WifiDev = "wlan0"
) )
func init() { func init() {
if PowerLevels == nil { if PowerLevels == nil {
PowerLevels = make(map[string]*PowerLevel) PowerLevels = make(map[string]*PowerLevel)

View File

@@ -8,14 +8,10 @@ type HelloWorldPage struct {
UI.Page UI.Page
} }
type HelloWorldPlugin struct { type HelloWorldPlugin struct {
UI.Plugin UI.Plugin
} }
func (self *HelloWorldPlugin) Init(main_screen *UI.MainScreen) { func (self *HelloWorldPlugin) Init(main_screen *UI.MainScreen) {
} }
@@ -25,8 +21,3 @@ func (self *HelloWorldPlugin) Run( main_screen *UI.MainScreen ) {
} }
var APIOBJ HelloWorldPlugin var APIOBJ HelloWorldPlugin

View File

@@ -132,4 +132,3 @@ func LoadEncryptionMethods(wired bool) []*CurType {
return encryptionTypes return encryptionTypes
} }