minor change

This commit is contained in:
faiface 2017-05-09 15:26:50 +02:00
parent 80735cfc0c
commit f58676289a
1 changed files with 17 additions and 17 deletions

View File

@ -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)
}