master
Jordan Orelli 4 years ago
parent 04346a65b1
commit fa732377c7

@ -48,18 +48,27 @@ func (c *chatView) handleEvent(e tcell.Event) change {
func (c *chatView) draw(img canvas, st *state) {
bounds := img.bounds()
fill(img, tcell.StyleDefault.Background(tcell.NewRGBColor(32, 32, 32)))
style := tcell.StyleDefault.Background(tcell.NewRGBColor(32, 32, 32))
fill(img, style)
chatHeight := bounds.Height - 1
for i := 0; i < math.Min(chatHeight, len(st.history)); i++ {
msg := st.history[len(st.history)-1-i]
s := fmt.Sprintf("%12s: %s", msg.From, msg.Text)
writeString(img, s, math.Vec{0, bounds.Height - 2 - i}, tcell.StyleDefault)
nameText := fmt.Sprintf("%12s: ", msg.From)
if msg.From == st.playerName {
style := style.Foreground(tcell.NewRGBColor(255, 32, 32))
writeString(img, nameText, math.Vec{0, bounds.Height - 2 - i}, style)
} else {
style := style.Foreground(tcell.NewRGBColor(32, 32, 255))
writeString(img, nameText, math.Vec{0, bounds.Height - 2 - i}, style)
}
writeString(img, msg.Text, math.Vec{14, bounds.Height - 2 - i}, style)
}
writeString(img, c.composing, math.Vec{0, bounds.Height - 1}, tcell.StyleDefault)
writeString(img, c.composing, math.Vec{0, bounds.Height - 1}, style)
if c.inFocus {
cursor := tile{r: tcell.RuneBlock, style: tcell.StyleDefault.Blink(true)}
cursor := tile{r: tcell.RuneBlock, style: style.Blink(true)}
img.setTile(len([]rune(c.composing)), bounds.Height-1, cursor)
}
}

@ -34,7 +34,7 @@ func (v *gameView) handleEvent(e tcell.Event) change {
}
func (v *gameView) draw(img canvas, st *state) {
fill(img, tcell.StyleDefault.Background(tcell.NewRGBColor(128, 128, 128)))
fill(img, tcell.StyleDefault.Background(tcell.NewRGBColor(0, 0, 12)))
v.drawHeader(img, st)
// fill in background dots first

Loading…
Cancel
Save