From a8f803495ebfbb39d4d707a2b5ad4591d75c158e Mon Sep 17 00:00:00 2001 From: surdeus Date: Thu, 15 Jun 2023 20:25:16 +0300 Subject: [PATCH] Better camera scaling for zoom and stuff. --- src/cmd/test/main.go | 5 +++++ src/gx/camera.go | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/cmd/test/main.go b/src/cmd/test/main.go index cc04572..6bfedba 100644 --- a/src/cmd/test/main.go +++ b/src/cmd/test/main.go @@ -37,6 +37,11 @@ func NewTri() *Tri { gx.V(100, 100), 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.Visible = true diff --git a/src/gx/camera.go b/src/gx/camera.go index 8159d4d..3614995 100644 --- a/src/gx/camera.go +++ b/src/gx/camera.go @@ -16,9 +16,9 @@ func (c *Camera)RealMatrix( e *Engine, ) Matrix { g := &Matrix{} - g.Scale(c.S.X, c.S.Y) g.Translate(-c.P.X, -c.P.Y) g.Rotate(c.R) + g.Scale(c.S.X, c.S.Y) g.Translate(c.RA.X, c.RA.Y) return *g