It can draw a damn rectangle now.

This commit is contained in:
Andrey Parhomenko 2023-05-22 23:51:14 +03:00
parent e5dfe002a0
commit 874ddb14e2
3 changed files with 9 additions and 5 deletions

View file

@ -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,

View file

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

View file

@ -14,7 +14,9 @@ type Transform struct {
// Returns empty Transform.
func T() Transform {
ret := Transform{}
ret := Transform{
S: Vector{1, 1},
}
return ret
}