diff options
author | Zach Latta <zach@zachlatta.com> | 2016-03-08 15:00:55 -0800 |
---|---|---|
committer | Zach Latta <zach@zachlatta.com> | 2016-03-08 15:00:55 -0800 |
commit | dbaa2dafebf0f860b01042a18e15116d4069f228 (patch) | |
tree | f2d9699c7b1d10f6bf7947869feeec1e038e6f81 | |
parent | fdaeddb19f400b7ea467492d02f2430cd23cbc2d (diff) | |
download | sshtron-dbaa2dafebf0f860b01042a18e15116d4069f228.tar.gz |
Hopefully fix #5
-rw-r--r-- | game.go | 7 |
1 files changed, 5 insertions, 2 deletions
@@ -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) { |