mirror of
https://github.com/clockworkpi/LauncherGoDev.git
synced 2025-12-12 16:08:52 +01:00
about
This commit is contained in:
parent
2306f3036f
commit
bac1ee6d40
@ -1,6 +1,9 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"fmt"
|
||||||
|
"strconv"
|
||||||
|
|
||||||
"strings"
|
"strings"
|
||||||
"os/exec"
|
"os/exec"
|
||||||
|
|
||||||
@ -88,7 +91,7 @@ type AboutPage struct {
|
|||||||
Scroller *UI.ListScroller
|
Scroller *UI.ListScroller
|
||||||
|
|
||||||
MyList []*InfoPageListItem
|
MyList []*InfoPageListItem
|
||||||
Icons map[string]IconItemInterface
|
Icons map[string]UI.IconItemInterface
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewAboutPage() *AboutPage {
|
func NewAboutPage() *AboutPage {
|
||||||
@ -108,7 +111,7 @@ func NewAboutPage() *AboutPage {
|
|||||||
|
|
||||||
p.Index = 0
|
p.Index = 0
|
||||||
|
|
||||||
p.Icons = make(map[string]IconItemInterface)
|
p.Icons = make(map[string]UI.IconItemInterface)
|
||||||
return p
|
return p
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -138,11 +141,11 @@ func (self *AboutPage) Uname() {
|
|||||||
|
|
||||||
func (self *AboutPage) CpuMhz() {
|
func (self *AboutPage) CpuMhz() {
|
||||||
|
|
||||||
lines, err := readLines("/sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq")
|
lines, err := UI.ReadLines("/sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq")
|
||||||
UI.ShowErr(err)
|
UI.ShowErr(err)
|
||||||
|
|
||||||
mhz ,_ := strconv.ParseInt(lines[0], 10, 0))
|
mhz ,err := strconv.ParseInt(lines[0], 10, 64)
|
||||||
|
UI.ShowErr(err)
|
||||||
mhz_float := float64(mhz)/1000.0
|
mhz_float := float64(mhz)/1000.0
|
||||||
|
|
||||||
out := make(map[string]string)
|
out := make(map[string]string)
|
||||||
@ -159,7 +162,7 @@ func (self *AboutPage) CpuInfo() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (self *AboutPage) MemInfo() {
|
func (self *AboutPage) MemInfo() {
|
||||||
lines, err := readLines("/proc/meminfo")
|
lines, err := UI.ReadLines("/proc/meminfo")
|
||||||
UI.ShowErr(err)
|
UI.ShowErr(err)
|
||||||
|
|
||||||
for _,line := range lines {
|
for _,line := range lines {
|
||||||
@ -188,7 +191,7 @@ func (self *AboutPage) GenList() {
|
|||||||
start_y := 10
|
start_y := 10
|
||||||
last_height := 0
|
last_height := 0
|
||||||
|
|
||||||
for i,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()
|
||||||
@ -207,7 +210,8 @@ func (self *AboutPage) GenList() {
|
|||||||
|
|
||||||
li.Flag = val["key"]
|
li.Flag = val["key"]
|
||||||
li.SetSmallText(val["value"])
|
li.SetSmallText(val["value"])
|
||||||
|
last_height += li.Height
|
||||||
|
|
||||||
self.MyList = append(self.MyList,li)
|
self.MyList = append(self.MyList,li)
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -228,7 +232,7 @@ func (self *AboutPage) Init() {
|
|||||||
self.Width = self.Screen.Width
|
self.Width = self.Screen.Width
|
||||||
self.Height = self.Screen.Height
|
self.Height = self.Screen.Height
|
||||||
|
|
||||||
bgpng := NewIconItem()
|
bgpng := UI.NewIconItem()
|
||||||
bgpng.ImgSurf = UI.MyIconPool.GetImgSurf("about_bg")
|
bgpng.ImgSurf = UI.MyIconPool.GetImgSurf("about_bg")
|
||||||
bgpng.MyType = UI.ICON_TYPES["STAT"]
|
bgpng.MyType = UI.ICON_TYPES["STAT"]
|
||||||
bgpng.Parent = self
|
bgpng.Parent = self
|
||||||
@ -240,7 +244,7 @@ func (self *AboutPage) Init() {
|
|||||||
self.CpuInfo()
|
self.CpuInfo()
|
||||||
self.MemInfo()
|
self.MemInfo()
|
||||||
self.CpuMhz()
|
self.CpuMhz()
|
||||||
self.Uname()
|
self.Uname()
|
||||||
|
|
||||||
self.GenList()
|
self.GenList()
|
||||||
|
|
||||||
|
|||||||
BIN
Menu/GameShell/10_Settings/About/about.so
Normal file
BIN
Menu/GameShell/10_Settings/About/about.so
Normal file
Binary file not shown.
@ -85,7 +85,7 @@ func (self *SettingsPage) Init() {
|
|||||||
self.CanvasHWND = self.Screen.CanvasHWND
|
self.CanvasHWND = self.Screen.CanvasHWND
|
||||||
|
|
||||||
|
|
||||||
ps := &SettingsPageSelector{}
|
ps := NewSettingsPageSelector()
|
||||||
ps.Parent = self
|
ps.Parent = self
|
||||||
self.Ps = ps
|
self.Ps = ps
|
||||||
self.PsIndex = 0
|
self.PsIndex = 0
|
||||||
@ -142,7 +142,18 @@ func (self *SettingsPage) ScrollDown() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (self *SettingsPage) Click() {
|
func (self *SettingsPage) Click() {
|
||||||
|
if len(self.MyList) == 0 {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
cur_li := self.MyList[self.PsIndex]
|
||||||
|
|
||||||
|
lk_obj := cur_li.GetLinkObj()
|
||||||
|
|
||||||
|
if lk_obj != nil {
|
||||||
|
lk_obj.Run(self.Screen)
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (self *SettingsPage) KeyDown( ev *event.Event) {
|
func (self *SettingsPage) KeyDown( ev *event.Event) {
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
5
build.sh
5
build.sh
@ -12,3 +12,8 @@ cd Menu/GameShell/10_Settings
|
|||||||
go build -o Settings.so -buildmode=plugin
|
go build -o Settings.so -buildmode=plugin
|
||||||
cd -
|
cd -
|
||||||
|
|
||||||
|
cd Menu/GameShell/10_Settings/About
|
||||||
|
go build -o about.so -buildmode=plugin
|
||||||
|
cd -
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -80,11 +80,7 @@ func NewIconItem() *IconItem {
|
|||||||
i.MyType = ICON_TYPES["EXE"]
|
i.MyType = ICON_TYPES["EXE"]
|
||||||
|
|
||||||
i.Align = ALIGN["VCenter"]
|
i.Align = ALIGN["VCenter"]
|
||||||
|
|
||||||
l := NewLabel()
|
|
||||||
|
|
||||||
i.Label = l
|
|
||||||
|
|
||||||
return i
|
return i
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -12,7 +12,7 @@ var PC map[string]string
|
|||||||
|
|
||||||
|
|
||||||
func DefinePC() {
|
func DefinePC() {
|
||||||
PC["UP"] = "Up"
|
PC["Up"] = "Up"
|
||||||
PC["Down"] = "Down"
|
PC["Down"] = "Down"
|
||||||
PC["Left"] = "Left"
|
PC["Left"] = "Left"
|
||||||
PC["Right"] = "Right"
|
PC["Right"] = "Right"
|
||||||
@ -30,7 +30,7 @@ func DefinePC() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func DefineGameShell() {
|
func DefineGameShell() {
|
||||||
GameShell["UP"] = "Up"
|
GameShell["Up"] = "Up"
|
||||||
GameShell["Down"] = "Down"
|
GameShell["Down"] = "Down"
|
||||||
GameShell["Left"] = "Left"
|
GameShell["Left"] = "Left"
|
||||||
GameShell["Right"] = "Right"
|
GameShell["Right"] = "Right"
|
||||||
|
|||||||
@ -11,11 +11,15 @@ import (
|
|||||||
type ListItemInterface interface {
|
type ListItemInterface interface {
|
||||||
|
|
||||||
Init(text string)
|
Init(text string)
|
||||||
|
|
||||||
Size() (int,int)
|
Size() (int,int)
|
||||||
NewSize(w,h int)
|
NewSize(w,h int)
|
||||||
Coord() (int,int)
|
Coord() (int,int)
|
||||||
NewCoord(x,y int)
|
NewCoord(x,y int)
|
||||||
|
|
||||||
|
GetLinkObj() PluginInterface
|
||||||
Draw()
|
Draw()
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
type ListItem struct {
|
type ListItem struct {
|
||||||
@ -61,10 +65,13 @@ func (self *ListItem) Size() (int,int) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
func (self *ListItem) GetLinkObj() PluginInterface {
|
||||||
|
return self.LinkObj
|
||||||
|
}
|
||||||
|
|
||||||
func (self *ListItem) Draw() {
|
func (self *ListItem) Draw() {
|
||||||
x_,_ := self.Labels["Text"].Coord()
|
x_,_ := self.Labels["Text"].Coord()
|
||||||
h_,_ := self.Labels["Text"].Size()
|
_,h_ := self.Labels["Text"].Size()
|
||||||
|
|
||||||
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()
|
||||||
|
|||||||
@ -751,7 +751,7 @@ func (self *Page) ResetPageSelector() {
|
|||||||
|
|
||||||
func (self *Page) DrawPageSelector() {
|
func (self *Page) DrawPageSelector() {
|
||||||
if self.Ps.GetOnShow() == true {
|
if self.Ps.GetOnShow() == true {
|
||||||
fmt.Println("DrawPageSelector")
|
// fmt.Println("DrawPageSelector")
|
||||||
self.Ps.Draw()
|
self.Ps.Draw()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -8,7 +8,8 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"bufio"
|
"bufio"
|
||||||
"bytes"
|
"bytes"
|
||||||
|
"io"
|
||||||
|
|
||||||
"github.com/cuu/gogame/display"
|
"github.com/cuu/gogame/display"
|
||||||
|
|
||||||
"github.com/cuu/LauncherGo/sysgo"
|
"github.com/cuu/LauncherGo/sysgo"
|
||||||
@ -122,33 +123,34 @@ func SwapAndShow() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func ReadLines(path string)(lines [] string,err error){
|
func ReadLines(path string)(lines [] string,err error){
|
||||||
var (
|
var (
|
||||||
file *os.File
|
file *os.File
|
||||||
part [] byte
|
part [] byte
|
||||||
prefix bool
|
prefix bool
|
||||||
)
|
)
|
||||||
|
|
||||||
if file, err = os.Open(path); err != nil {
|
if file, err = os.Open(path); err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
reader := bufio.NewReader(file)
|
reader := bufio.NewReader(file)
|
||||||
buffer := bytes.NewBuffer(make([]byte,1024))
|
buffer := bytes.NewBuffer(make([]byte,0))
|
||||||
|
|
||||||
for {
|
for {
|
||||||
if part, prefix, err = reader.ReadLine();err != nil {
|
if part, prefix, err = reader.ReadLine();err != nil {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
buffer.Write(part)
|
buffer.Write(part)
|
||||||
if !prefix {
|
if !prefix {
|
||||||
lines = append(lines,buffer.String())
|
lines = append(lines,buffer.String())
|
||||||
buffer.Reset()
|
buffer.Reset()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if err == io.EOF {
|
|
||||||
err = nil
|
if err == io.EOF {
|
||||||
}
|
err = nil
|
||||||
return
|
}
|
||||||
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
func WriteLines(lines [] string,path string)(err error){
|
func WriteLines(lines [] string,path string)(err error){
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user