Use buffer background color for table header row
This commit is contained in:
parent
af879d0f03
commit
1ba29af176
3 changed files with 21 additions and 7 deletions
2
flags.go
2
flags.go
|
@ -21,7 +21,7 @@ import (
|
|||
)
|
||||
|
||||
func fetchMatches(matches []*bgammon.GameListing) []*bgammon.GameListing {
|
||||
url := "https://api.bgammon.org:1338/matches.json"
|
||||
url := "https://bgammon.org/api/matches.json"
|
||||
|
||||
req, err := http.NewRequest(http.MethodGet, url, nil)
|
||||
if err != nil {
|
||||
|
|
|
@ -1352,12 +1352,15 @@ func (g *Game) initialize() {
|
|||
dividerLine.SetBackground(bufferTextColor)
|
||||
|
||||
dateLabel := newCenteredText(gotext.Get("Date"))
|
||||
dateLabel.SetBackground(bufferBackgroundColor)
|
||||
dateLabel.SetFollow(false)
|
||||
dateLabel.SetScrollBarVisible(false)
|
||||
resultLabel := newCenteredText(gotext.Get("Result"))
|
||||
resultLabel.SetBackground(bufferBackgroundColor)
|
||||
resultLabel.SetFollow(false)
|
||||
resultLabel.SetScrollBarVisible(false)
|
||||
opponentLabel := newCenteredText(gotext.Get("Opponent"))
|
||||
opponentLabel.SetBackground(bufferBackgroundColor)
|
||||
opponentLabel.SetFollow(false)
|
||||
opponentLabel.SetScrollBarVisible(false)
|
||||
if smallScreen {
|
||||
|
@ -1483,15 +1486,19 @@ func (g *Game) initialize() {
|
|||
dividerLine.SetBackground(triangleA)
|
||||
|
||||
statusLabel := newCenteredText(gotext.Get("Status"))
|
||||
statusLabel.SetBackground(bufferBackgroundColor)
|
||||
statusLabel.SetFollow(false)
|
||||
statusLabel.SetScrollBarVisible(false)
|
||||
ratingLabel := newCenteredText(gotext.Get("Rating"))
|
||||
ratingLabel.SetBackground(bufferBackgroundColor)
|
||||
ratingLabel.SetFollow(false)
|
||||
ratingLabel.SetScrollBarVisible(false)
|
||||
pointsLabel := newCenteredText(gotext.Get("Points"))
|
||||
pointsLabel.SetBackground(bufferBackgroundColor)
|
||||
pointsLabel.SetFollow(false)
|
||||
pointsLabel.SetScrollBarVisible(false)
|
||||
nameLabel := newCenteredText(gotext.Get("Match Name"))
|
||||
nameLabel.SetBackground(bufferBackgroundColor)
|
||||
nameLabel.SetFollow(false)
|
||||
nameLabel.SetScrollBarVisible(false)
|
||||
if smallScreen {
|
||||
|
|
|
@ -135,7 +135,7 @@ func NewLobby() *lobby {
|
|||
|
||||
indentA, indentB := etk.Scale(lobbyIndentA), etk.Scale(lobbyIndentB)
|
||||
|
||||
matchList := etk.NewList(game.itemHeight(), nil)
|
||||
matchList := etk.NewList(game.itemHeight(), l.selectMatch)
|
||||
matchList.SetSelectionMode(etk.SelectRow)
|
||||
matchList.SetConfirmedFunc(l.confirmSelectMatch)
|
||||
matchList.SetColumnSizes(indentA, indentB-indentA, indentB-indentA, -1)
|
||||
|
@ -401,10 +401,14 @@ func (l *lobby) rebuildButtonsGrid() {
|
|||
r := l.buttonsGrid.Rect()
|
||||
l.buttonsGrid.Clear()
|
||||
|
||||
buttons := l.getButtons()
|
||||
var btns []string
|
||||
{
|
||||
buttons := l.getButtons()
|
||||
btns = make([]string, len(buttons))
|
||||
copy(btns, buttons)
|
||||
}
|
||||
if l.createGamePending || l.joiningGameID != 0 {
|
||||
btns := make([]string, len(buttons))
|
||||
for i, label := range buttons {
|
||||
for i, label := range btns {
|
||||
if l.createGamePending && (label == gotext.Get("Create match") || label == gotext.Get("Create")) {
|
||||
btns[i] = gotext.Get("Creating...")
|
||||
} else if l.joiningGameID != 0 && (label == gotext.Get("Join match") || label == gotext.Get("Join")) {
|
||||
|
@ -413,15 +417,18 @@ func (l *lobby) rebuildButtonsGrid() {
|
|||
btns[i] = label
|
||||
}
|
||||
}
|
||||
buttons = btns
|
||||
}
|
||||
for i, label := range buttons {
|
||||
for i, label := range btns {
|
||||
l.buttonsGrid.AddChildAt(etk.NewButton(label, l.selectButton(i)), i, 0, 1, 1)
|
||||
}
|
||||
|
||||
l.buttonsGrid.SetRect(r)
|
||||
}
|
||||
|
||||
func (l *lobby) selectMatch(selected int) bool {
|
||||
return true
|
||||
}
|
||||
|
||||
func (l *lobby) confirmSelectMatch(selected int) {
|
||||
if selected < 0 || selected >= len(l.games) {
|
||||
return
|
||||
|
|
Loading…
Reference in a new issue