This commit is contained in:
cuu
2018-11-25 02:21:29 +08:00
parent 7b9f42ac2e
commit 515763d954
9 changed files with 275 additions and 39 deletions

View File

@@ -16,6 +16,7 @@ import (
type ListPageSelector struct {
PageSelector
BackgroundColor *color.Color
Parent *ConfirmPage
}
func NewListPageSelector() *ListPageSelector {
@@ -27,7 +28,7 @@ func NewListPageSelector() *ListPageSelector {
func (self *ListPageSelector) Draw() {
idx := self.Parent.GetPsIndex()
mylist := self.Parent.GetMyList()
mylist := self.Parent.MyList
if idx > (len(mylist) -1) {
idx = len(mylist)
if idx > 0 {
@@ -78,33 +79,36 @@ func NewConfirmPage() *ConfirmPage {
}
func (self *ConfirmPage) GetMyList() []LabelInterface {
return self.MyList
}
func (self *ConfirmPage) Reset() {
self.MyList[0].SetText(self.ConfirmText)
x,y := self.MyList[0].Coord()
w,h := self.MyList[0].Size()
self.MyList[0].PosX = (self.Width - self.MyList[0].Width)/2
self.MyList[0].PosY = (self.Width - self.MyList[0].Height)/2
self.MyList[0].NewCoord( (self.Width - w)/2, (self.Width - h)/2)
self.BGPosX = self.MyList[0].PosX - 10
self.BGPosY = self.MyList[0].PosY - 10
x,y = self.MyList[0].Coord()
self.BGWidth = self.MyList[0].Width + 20
self.BGHeight = self.MyList[0].Height +20
self.BGPosX = x - 10
self.BGPosY = y - 10
self.BGWidth = w + 20
self.BGHeight = h + 20
}
func (self *ConfirmPage) SnapMsg(msg string) {
self.MyList[0].SetText(msg)
self.MyList[0].PosX = (self.Width - self.MyList[0].Width)/2
self.MyList[0].PosY = (self.Width - self.MyList[0].Height)/2
x,y := self.MyList[0].Coord()
w,h := self.MyList[0].Size()
self.MyList[0].NewCoord( (self.Width - w )/2, (self.Width - h)/2 )
self.BGPosX = self.MyList[0].PosX - 10
self.BGPosY = self.MyList[0].PosY - 10
x, y = self.MyList[0].Coord()
self.BGWidth = self.MyList[0].Width + 20
self.BGHeight = self.MyList[0].Height +20
self.BGPosX = x - 10
self.BGPosY = y - 10
self.BGWidth = w + 20
self.BGHeight = h +20
}
@@ -123,7 +127,7 @@ func (self *ConfirmPage) Init() {
li := NewLabel()
li.SetCanvasHWND(self.CanvasHWND)
li.Init(self.ConfirmText,self.ListFont)
li.Init(self.ConfirmText,self.ListFont,nil)
li.PosX = (self.Width - li.Width)/2
li.PosY = (self.Height - li.Height)/2

View File

@@ -48,7 +48,7 @@ func (self *InfoPageListItem) Draw() {
self.Labels["Text"].SetColor(&color.Color{83,83,83,255} ) // SkinManager().GiveColor("Text")
}
x,y := self.Labels["Text"].Coord()
x,_ := self.Labels["Text"].Coord()
w,h := self.Labels["Text"].Size()
self.Labels["Text"].NewCoord( x + self.PosX, self.PosY + (self.Height - h)/2 )
@@ -58,7 +58,7 @@ func (self *InfoPageListItem) Draw() {
self.Labels["Text"].NewCoord(x, self.PosY + (self.Height - h)/2 )
if _, ok := self.Labels["Small"]; ok {
x,y = self.Labels["Small"].Coord()
x,_ = self.Labels["Small"].Coord()
w,h = self.Labels["Small"].Size()
self.Labels["Small"].NewCoord( self.Width - w + 5 , self.PosY + (self.Height - h)/2 )

View File

@@ -35,8 +35,8 @@ func (self *InfoPageSelector) Draw() {
mylist := self.Parent.GetMyList()
if idx < len(mylist) {
x,y := mylist[idx].Coord()
w,h := mylist[idx].Size()
_,y := mylist[idx].Coord()
_,h := mylist[idx].Size()
self.PosY = y+1
self.Height = h-3

View File

@@ -1,7 +1,10 @@
package UI
import (
"fmt"
"strings"
"github.com/cuu/gogame/font"
"github.com/cuu/gogame/draw"
"github.com/cuu/gogame/surface"
"github.com/cuu/gogame/color"
@@ -52,12 +55,10 @@ func (self *KeyboardSelector) Draw() {
row_idx := self.Parent.RowIndex
idx := self.Parent.PsIndex
x := self.Parent.SecsKeys[sec_idx][row_idx][idx].PosX
y := self.Parent.SecsKeys[sec_idx][row_idx][idx].PosY
w := self.Parent.SecsKeys[sec_idx][row_idx][idx].Width+6
h := self.Parent.SecsKeys[sec_idx][row_idx][idx].Height+1
x, y := self.Parent.SecsKeys[sec_idx][row_idx][idx].Coord()
w, h := self.Parent.SecsKeys[sec_idx][row_idx][idx].Size()
rect_ := draw.MidRect(x,y,w,h,self.Parent.Width,self.Parent.Height)
rect_ := draw.MidRect(x,y,w+6,h+1,self.Parent.Width,self.Parent.Height)
if rect_.W <= 0 || rect_.H <= 0 {
return
@@ -200,7 +201,7 @@ func (self *Keyboard) Init() {
start_y = 84 * j * (word_margin+14)
for idx,val := range self.Secs[i][j] {
for _,val := range self.Secs[i][j] {
ti := NewTextItem()
ti.FontObj = fontobj
ti.Parent = self
@@ -248,9 +249,10 @@ func (self *Keyboard) Init() {
ps.Parent = self
ps.Init(start_x,start_y,25,25,128)
ps.OnShow = true
self.Ps = ps
self.PsIndex = 0
self.Ps.OnShow = true
}
@@ -295,7 +297,7 @@ func (self *Keyboard) SelectNextChar() {
row_idx := self.RowIndex
self.PsIndex+=1
if self._PsIndex >= len(self.SecsKeys[sec_idx][row_idx]) {
if self.PsIndex >= len(self.SecsKeys[sec_idx][row_idx]) {
self.PsIndex = 0
self.RowIndex+=1
@@ -330,7 +332,8 @@ func (self *Keyboard) SelectPrevChar() {
func (self *Keyboard) ClickOnChar() {
sec_idx := self.SectionIndex
alphabet := self.SecsKeys[sec_idx][self.RowIndex][self.PsIndex].Str
alphabet := self.SecsKeys[sec_idx][self.RowIndex][self.PsIndex].GetStr()
if alphabet == "Space"{
alphabet = " "
}
@@ -387,7 +390,8 @@ func (self *Keyboard) KeyboardShift() {
for j:=0;j<self.SectionNumbers;j++ {
for _,u := range self.SecsKeys[j] {
for _,x := range u {
x.PosX = += self.LeftOrRight*v
x_,y_ := x.Coord()
x.NewCoord(x_+self.LeftOrRight*v,y_)
}
}
}
@@ -399,7 +403,7 @@ func (self *Keyboard) KeyboardShift() {
}
}
func (self *keyboard) ShiftKeyboardPage() {
func (self *Keyboard) ShiftKeyboardPage() {
self.KeyboardShift()
self.SectionIndex -= self.LeftOrRight
self.Draw()

View File

@@ -28,7 +28,7 @@ var (
plugin_flag = "plugin.config"
)
type ActionConifg struct {
type ActionConfig struct {
ROM string `json:"ROM"`
ROM_SO string `json:"ROM_SO"`
EXT []string `json:"EXT"`

View File

@@ -12,10 +12,13 @@ import (
)
type TextItemInterface interface{
IconItemInterface
GetBold() bool
SetBold(bold bool)
GetStr() string
Draw()
}