aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZach Latta <zach@zachlatta.com>2016-03-08 15:00:55 -0800
committerZach Latta <zach@zachlatta.com>2016-03-08 15:00:55 -0800
commitdbaa2dafebf0f860b01042a18e15116d4069f228 (patch)
treef2d9699c7b1d10f6bf7947869feeec1e038e6f81
parentfdaeddb19f400b7ea467492d02f2430cd23cbc2d (diff)
downloadsshtron-dbaa2dafebf0f860b01042a18e15116d4069f228.tar.gz
Hopefully fix #5
-rw-r--r--game.go7
1 files changed, 5 insertions, 2 deletions
diff --git a/game.go b/game.go
index a05baa4..12a8a10 100644
--- a/game.go
+++ b/game.go
@@ -7,6 +7,7 @@ import (
"github.com/dustinkirkland/golang-petname"
"github.com/fatih/color"
"golang.org/x/crypto/ssh"
+ "io"
"math/rand"
"sort"
"time"
@@ -727,10 +728,12 @@ func (g *Game) Update(delta float64) {
func (g *Game) Render(s *Session) {
worldStr := g.worldString(s)
- fmt.Fprint(s, "\033[H\033[2J")
+ var b bytes.Buffer
+ b.WriteString("\033[H\033[2J")
+ b.WriteString(worldStr)
// Send over the rendered world
- fmt.Fprint(s, worldStr)
+ io.Copy(s, &b)
}
func (g *Game) AddSession(s *Session) {
Un proyecto texto-plano.xyz