From f58676289a7185bd83be68064fe522cfae6631f1 Mon Sep 17 00:00:00 2001 From: faiface Date: Tue, 9 May 2017 15:26:50 +0200 Subject: [PATCH] minor change --- text/text.go | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/text/text.go b/text/text.go index 3c2c338..48eed6a 100644 --- a/text/text.go +++ b/text/text.go @@ -187,6 +187,23 @@ func (txt *Text) WriteRune(r rune) (n int, err error) { return n, nil } +func (txt *Text) Draw(t pixel.Target) { + if txt.dirty { + txt.trans.SetLen(txt.tris.Len()) + txt.trans.Update(&txt.tris) + + for i := range txt.trans { + txt.trans[i].Position = txt.mat.Project(txt.trans[i].Position) + txt.trans[i].Color = txt.trans[i].Color.Mul(txt.col) + } + + txt.transD.Dirty() + txt.dirty = false + } + + txt.transD.Draw(t) +} + // controlRune checks if r is a control rune (newline, tab, ...). If it is, a new dot position and // true is returned. If r is not a control rune, the original dot and false is returned. func (txt *Text) controlRune(r rune, dot pixel.Vec) (newDot pixel.Vec, control bool) { @@ -252,20 +269,3 @@ func (txt *Text) drawBuf() { } } } - -func (txt *Text) Draw(t pixel.Target) { - if txt.dirty { - txt.trans.SetLen(txt.tris.Len()) - txt.trans.Update(&txt.tris) - - for i := range txt.trans { - txt.trans[i].Position = txt.mat.Project(txt.trans[i].Position) - txt.trans[i].Color = txt.trans[i].Color.Mul(txt.col) - } - - txt.transD.Dirty() - txt.dirty = false - } - - txt.transD.Draw(t) -}