Better camera scaling for zoom and stuff.

This commit is contained in:
Andrey Parhomenko 2023-06-15 20:25:16 +03:00
parent fea745e6e1
commit a8f803495e
2 changed files with 6 additions and 1 deletions

View file

@ -37,6 +37,11 @@ func NewTri() *Tri {
gx.V(100, 100), gx.V(100, 100),
gx.V(0, -50), gx.V(0, -50),
}, },
gx.Triangle{
gx.V(0, 0),
gx.V(-100, -100),
gx.V(0, 50),
},
} }
ret.Color = gx.Color{gx.MaxColorV, gx.MaxColorV, 0, gx.MaxColorV} ret.Color = gx.Color{gx.MaxColorV, gx.MaxColorV, 0, gx.MaxColorV}
ret.Visible = true ret.Visible = true

View file

@ -16,9 +16,9 @@ func (c *Camera)RealMatrix(
e *Engine, e *Engine,
) Matrix { ) Matrix {
g := &Matrix{} g := &Matrix{}
g.Scale(c.S.X, c.S.Y)
g.Translate(-c.P.X, -c.P.Y) g.Translate(-c.P.X, -c.P.Y)
g.Rotate(c.R) g.Rotate(c.R)
g.Scale(c.S.X, c.S.Y)
g.Translate(c.RA.X, c.RA.Y) g.Translate(c.RA.X, c.RA.Y)
return *g return *g