keyboard showed up

This commit is contained in:
cuu 2018-11-27 18:14:07 +08:00
parent fc7afbb680
commit d043f2fecf
7 changed files with 24 additions and 4 deletions

View File

@ -95,6 +95,11 @@ type Keyboard struct {
func NewKeyboard() *Keyboard { func NewKeyboard() *Keyboard {
p := &Keyboard{} p := &Keyboard{}
p.PageIconMargin = 20
p.SelectedIconTopOffset = 20
p.Align = ALIGN["SLeft"]
p.EasingDur = 10 p.EasingDur = 10
p.SectionNumbers = 3 p.SectionNumbers = 3
@ -199,7 +204,7 @@ func (self *Keyboard) Init() {
start_x = (self.Width-fw- len(self.Secs[i][j])*word_margin)/2+word_margin/2 start_x = (self.Width-fw- len(self.Secs[i][j])*word_margin)/2+word_margin/2
start_x = start_x + i*self.Width start_x = start_x + i*self.Width
start_y = 84 * j * (word_margin+14) start_y = 84 + j * (word_margin+14)
for _,val := range self.Secs[i][j] { for _,val := range self.Secs[i][j] {
ti := NewTextItem() ti := NewTextItem()
@ -432,11 +437,23 @@ func (self *Keyboard) KeyDown( ev *event.Event) {
return return
} }
if ev.Data["Key"] == CurKeys["B"] { if ev.Data["Key"] == CurKeys["B"] || ev.Data["Key"] == CurKeys["Enter"] {
self.ClickOnChar() self.ClickOnChar()
return return
} }
if ev.Data["Key"] == CurKeys["X"] {
if self.SectionIndex <= 0 {
self.LeftOrRight = -1
}
if self.SectionIndex >= (self.SectionNumbers - 1) {
self.LeftOrRight = 1
}
self.ShiftKeyboardPage()
}
if ev.Data["Key"] == CurKeys["Menu"] { if ev.Data["Key"] == CurKeys["Menu"] {
self.ReturnToUpLevelPage() self.ReturnToUpLevelPage()

View File

@ -32,6 +32,9 @@ type TextItem struct {
func NewTextItem() *TextItem { func NewTextItem() *TextItem {
p := &TextItem{} p := &TextItem{}
p.Align = ALIGN["VCenter"]
p.Color = &color.Color{83,83,83,255} p.Color = &color.Color{83,83,83,255}
p.MyType = ICON_TYPES["LETTER"] p.MyType = ICON_TYPES["LETTER"]
p.Bold = false p.Bold = false

View File

@ -94,7 +94,7 @@ func (self *Textarea) AppendAndBlitText(alphabet string) {
} }
}else { }else {
fmt.Printf("is Full %s",strings.Join(self.MyWords,"")) fmt.Printf("is Full %s\n",strings.Join(self.MyWords,""))
} }
} }