From 95ac5e1e2ae3d0ad6586cac0fe2063e8736a01f0 Mon Sep 17 00:00:00 2001 From: Immueggpain Date: Sat, 13 Apr 2019 23:47:02 +0800 Subject: [PATCH] why 2 loops and assign twice? one is enough --- sprite.go | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/sprite.go b/sprite.go index 0808759..b7e1d25 100644 --- a/sprite.go +++ b/sprite.go @@ -102,16 +102,11 @@ func (s *Sprite) calcData() { (*s.tri)[5].Position = Vec{}.Sub(horizontal).Add(vertical) for i := range *s.tri { + (*s.tri)[i].Position = s.matrix.Project((*s.tri)[i].Position) (*s.tri)[i].Color = s.mask (*s.tri)[i].Picture = center.Add((*s.tri)[i].Position) (*s.tri)[i].Intensity = 1 } - // matrix and mask - for i := range *s.tri { - (*s.tri)[i].Position = s.matrix.Project((*s.tri)[i].Position) - (*s.tri)[i].Color = s.mask - } - s.d.Dirty() }