diff --git a/src/cmd/test/main.go b/src/cmd/test/main.go index 0bdfcaf..fd7647f 100644 --- a/src/cmd/test/main.go +++ b/src/cmd/test/main.go @@ -53,6 +53,7 @@ func NewRect() *Rect { } func (r *Rect) Update(e *gx.Engine) error { + r.R += 0.3 * e.DT() return nil } @@ -90,7 +91,7 @@ func (p *Player) Draw(e *gx.Engine, i *gx.Image) { Rectangle: gx.Rectangle{ Transform: gx.Transform{ P: player.P, - S: gx.Vector{10, 10}, + S: gx.Vector{100, 100}, }, }, Color: gx.Color{0, 0, gx.MaxColorV, gx.MaxColorV}, diff --git a/src/gx/rect.go b/src/gx/rect.go index da2b5c8..758e70e 100644 --- a/src/gx/rect.go +++ b/src/gx/rect.go @@ -41,8 +41,8 @@ func (r Rectangle) Triangles() Triangles { p1 := V(0, 0).Apply(&m) p2 := V(1, 0).Apply(&m) - p3 := V(1, -1).Apply(&m) - p4 := V(0, -1).Apply(&m) + p3 := V(1, 1).Apply(&m) + p4 := V(0, 1).Apply(&m) //fmt.Println("in:", p1, p2, p3, p4) @@ -66,17 +66,14 @@ func (r *DrawableRectangle) Draw( e *Engine, i *Image, ) { - t := r.Transform - + m := r.Matrix() + rm := e.Camera().RealMatrix(e) + m.Concat(rm) // Draw solid color if no shader. if r.Shader == nil { img := NewImage(1, 1) img.Set(0, 0, r.Color) - m := t.Matrix() - rm := e.Camera().RealMatrix(e) - - m.Concat(rm) opts := &ebiten.DrawImageOptions{ GeoM: m, @@ -103,11 +100,6 @@ func (r *DrawableRectangle) Draw( t.S.Y *= r.H }*/ - - rm := e.Camera().RealMatrix(e) - m := t.Matrix() - m.Concat(rm) - // Drawing with shader. opts := &ebiten.DrawRectShaderOptions{ GeoM: m,