diff --git a/main.go b/main.go index e3f91c5..8b71965 100644 --- a/main.go +++ b/main.go @@ -34,10 +34,9 @@ type Game struct { enemies []Position } -func (game *Game) Text(msg string) { - var comb []rune +func (game *Game) DrawStatus(msg string) { for x, cell := range msg { - game.screen.SetContent(x, game.height, cell, comb, tcell.StyleDefault) + game.screen.SetContent(x, game.height, cell, nil, tcell.StyleDefault) } } @@ -45,16 +44,15 @@ func (game *Game) Status(msg string) { game.status = msg } -func (game *Game) DrawEntity(symbol rune, pos Position) { - var comb []rune - game.screen.SetContent(pos.x, pos.y, symbol, comb, tcell.StyleDefault) +func (game *Game) DrawEntity(symbol rune, pos Position, color tcell.Color) { + style := tcell.StyleDefault.Bold(true).Foreground(color) + game.screen.SetContent(pos.x, pos.y, symbol, nil, style) } func (game *Game) DrawMap() { - var comb []rune for y, line := range game.level { for x, cell := range line { - game.screen.SetContent(x, y, cell, comb, tcell.StyleDefault) + game.screen.SetContent(x, y, cell, nil, tcell.StyleDefault) } } } @@ -63,13 +61,13 @@ func (game *Game) Render() { game.screen.Clear() game.DrawMap() - game.DrawEntity('@', game.player) + game.DrawEntity('@', game.player, tcell.ColorYellow) for _, pos := range game.enemies { - game.DrawEntity('G', pos) + game.DrawEntity('G', pos, tcell.ColorRed) } - game.Text(game.status) + game.DrawStatus(game.status) game.screen.Show() }