Browse Source

Increase padding around board

tableissue
Trevor Slocum 2 months ago
parent
commit
66b4866402
  1. 21
      app.go
  2. 22
      board.go
  3. 0
      test.txt

21
app.go

@ -221,22 +221,21 @@ func RunApp(c *Client) error {
// Single column on smaller screens
if screenX < 156 {
uiGrid.SetRows(15, -1, -1, 1)
uiGrid.SetRows(17, -1, 1, -1, 1)
uiGrid.AddItem(board, 0, 0, 1, 1, 0, 0, false)
uiGrid.AddItem(gameBuffer, 1, 0, 1, 1, 0, 0, false)
uiGrid.AddItem(statusBuffer, 2, 0, 1, 1, 0, 0, false)
uiGrid.AddItem(inputField, 3, 0, 1, 1, 0, 0, true)
uiGrid.AddItem(box, 2, 0, 1, 1, 0, 0, false)
uiGrid.AddItem(statusBuffer, 3, 0, 1, 1, 0, 0, false)
uiGrid.AddItem(inputField, 4, 0, 1, 1, 0, 0, true)
return
}
uiGrid.SetRows(15, -1, 1)
uiGrid.SetColumns(1, -1, 1, -1)
uiGrid.AddItem(box, 0, 0, 1, 1, 0, 0, false)
uiGrid.AddItem(board, 0, 1, 1, 1, 0, 0, false)
uiGrid.AddItem(box, 0, 2, 1, 1, 0, 0, false)
uiGrid.AddItem(statusBuffer, 0, 3, 2, 1, 0, 0, false)
uiGrid.AddItem(gameBuffer, 1, 0, 1, 2, 0, 0, false)
uiGrid.AddItem(inputField, 2, 0, 1, 4, 0, 0, true)
uiGrid.SetRows(17, -1, 1)
uiGrid.SetColumns(-1, 1, -1)
uiGrid.AddItem(board, 0, 0, 1, 3, 0, 0, false)
uiGrid.AddItem(gameBuffer, 1, 0, 1, 1, 0, 0, false)
uiGrid.AddItem(statusBuffer, 1, 2, 1, 1, 0, 0, false)
uiGrid.AddItem(inputField, 2, 0, 1, 3, 0, 0, true)
}
buildLayout(200, 200) // Initial build, resize is called later

22
board.go

@ -349,14 +349,15 @@ func (b *Board) Update() {
}
var t bytes.Buffer
t.WriteByte('\n')
t.WriteByte(' ')
t.WriteByte(' ')
t.WriteString("[\"space-off\"] [\"\"] \n")
t.WriteString("[\"space-off\"] [\"\"] \n")
t.WriteString("[\"space-off\"] ")
if white {
t.Write(boardTopWhite)
} else {
t.Write(boardTopBlack)
}
t.WriteString("[\"\"] ")
t.WriteByte('\n')
space := func(i int, j int) []byte {
@ -402,7 +403,8 @@ func (b *Board) Update() {
}
for i := 0; i < 11; i++ {
t.WriteByte(' ')
t.Write([]byte("[\"space-off\"] "))
if i == 5 {
t.WriteByte('v') // TODO
} else {
@ -410,6 +412,7 @@ func (b *Board) Update() {
}
t.WriteRune(cview.BoxDrawingsLightVertical)
t.Write([]byte("[\"\"]"))
for j := 0; j < 12; j++ {
t.Write(space(i, j))
@ -420,7 +423,7 @@ func (b *Board) Update() {
}
}
t.Write([]byte("[\"space-off\"]" + string(cview.BoxDrawingsLightVertical) + " [\"\"] "))
t.Write([]byte("[\"space-off\"]" + string(cview.BoxDrawingsLightVertical) + " "))
playerRollColor := "white"
opponentRollColor := "lightgray"
@ -463,16 +466,19 @@ func (b *Board) Update() {
t.Write([]byte("[-]"))
}
t.Write([]byte("[\"\"] "))
t.WriteByte('\n')
}
t.WriteByte(' ')
t.WriteByte(' ')
t.WriteString("[\"space-off\"] ")
if white {
t.Write(boardBottomWhite)
} else {
t.Write(boardBottomBlack)
}
t.WriteString(" [\"\"] \n")
t.WriteString("[\"space-off\"] [\"\"] \n")
t.WriteString("[\"space-off\"] [\"\"]")
b.TextView.SetBytes(t.Bytes())
}
@ -545,7 +551,7 @@ func (b *Board) handleHighlight(added, removed, remaining []string) {
defer b.Update()
if len(added) > 0 && len(remaining) > 0 {
if added[0] == "space-0" || added[0] == "space-0" {
if added[0] == "space-0" || added[0] == "space-0" { // TODO
b.TextView.SetHighlightedFunc(nil)
b.TextView.Highlight(added[0])
b.TextView.SetHighlightedFunc(b.handleHighlight)

0
test.txt

Loading…
Cancel
Save