diff --git a/src/cmd/test/main.go b/src/cmd/test/main.go index 93b99a4..be83bdb 100644 --- a/src/cmd/test/main.go +++ b/src/cmd/test/main.go @@ -127,9 +127,9 @@ func main() { e.Add(0, NewPlayer()) e.Add(1, &Debug{}) - e.Add(100, gx.Rectangle{ - W: 10000000, - H: 10000000, + e.Add(-1, gx.Rectangle{ + W: 100, + H: 100, T: gx.T(), C: gx.Color{ gx.MaxColorV, diff --git a/src/gx/rect.go b/src/gx/rect.go index 5f5b6be..35fa080 100644 --- a/src/gx/rect.go +++ b/src/gx/rect.go @@ -49,7 +49,7 @@ func (r Rectangle) Draw( e *Engine, i *Image, ) { - fmt.Println("drawing the rectangle") + fmt.Println("drawing the rectangle:", r) if r.S == nil { img := NewImage(1, 1) img.Set(0, 0, r.C) @@ -58,7 +58,9 @@ func (r Rectangle) Draw( t.S.X *= r.W t.S.Y *= r.H + rm := e.Camera().RealMatrix(e, true) m := t.Matrix(e) + m.Concat(rm) opts := &ebiten.DrawImageOptions{ GeoM: m, } diff --git a/src/gx/transform.go b/src/gx/transform.go index 27986c6..080e7b0 100644 --- a/src/gx/transform.go +++ b/src/gx/transform.go @@ -14,7 +14,9 @@ type Transform struct { // Returns empty Transform. func T() Transform { - ret := Transform{} + ret := Transform{ + S: Vector{1, 1}, + } return ret }