From 92db008ccfd624d419d9178b8ab932fa22797a09 Mon Sep 17 00:00:00 2001 From: surdeus Date: Sat, 18 Feb 2023 04:03:28 +0500 Subject: [PATCH] ... --- src/cmd/test/main.go | 3 ++- src/gx/main.go | 8 ++------ src/gx/transform.go | 1 + 3 files changed, 5 insertions(+), 7 deletions(-) diff --git a/src/cmd/test/main.go b/src/cmd/test/main.go index 0b0e3c2..2b370c8 100644 --- a/src/cmd/test/main.go +++ b/src/cmd/test/main.go @@ -20,8 +20,9 @@ func NewPlayer() *Player { Sprite: &gx.Sprite{ Object: &gx.Object{ T: gx.Transform { - P: gx.Vector{1, 1}, + P: gx.Vector{100, 150}, S: gx.Vector{5, 5}, + RA: gx.Vector{200, 200}, }, }, Image: playerImg, diff --git a/src/gx/main.go b/src/gx/main.go index c542ec5..db83b08 100644 --- a/src/gx/main.go +++ b/src/gx/main.go @@ -70,19 +70,15 @@ func (e *Engine) AddBehaver(b Behaver) { e.behavers = append(e.behavers, b) } -func (e *engine) setNewDT() { - e.dt = time.Since(e.lastTime).Seconds() - e.lastTime = time.Now() -} - func (e *engine) Update() error { eng := (*Engine)(e) - e.setNewDT() + e.dt = time.Since(e.lastTime).Seconds() for _, v := range eng.behavers { v.Update(eng) //fmt.Println(v) } + e.lastTime = time.Now() return nil } diff --git a/src/gx/transform.go b/src/gx/transform.go index b006c78..dd0b9e5 100644 --- a/src/gx/transform.go +++ b/src/gx/transform.go @@ -29,6 +29,7 @@ func (t Transform)Matrix() Matrix { g := &Matrix{} g.Scale(t.S.X, t.S.Y) + g.Translate(-t.RA.X, -t.RA.Y) g.Rotate(t.R) g.Translate(t.P.X, t.P.Y)