diff --git a/src/cmd/test/main.go b/src/cmd/test/main.go index 7181111..d2150ad 100644 --- a/src/cmd/test/main.go +++ b/src/cmd/test/main.go @@ -38,6 +38,8 @@ func NewPlayer() *Player { } func (p *Player) Start(e *gx.Engine) { + c := e.Camera() + c.Object.T.RA = gx.V(360, -120) } func (p *Player) Update(e *gx.Engine) error { @@ -84,12 +86,14 @@ func (p *Player) Update(e *gx.Engine) error { } else { c.Object.T.RA.X += gx.Pi * p.MoveSpeed * dt } + log.Println(c.Object.T.RA.X) case ebiten.KeyX : if e.KeyIsPressed(ebiten.KeyShift) { c.Object.T.RA.Y -= gx.Pi * p.MoveSpeed * dt } else { c.Object.T.RA.Y += gx.Pi * p.MoveSpeed * dt } + log.Println(c.Object.T.RA.Y) }} return nil diff --git a/src/gx/main.go b/src/gx/main.go index 8d6b5fb..4b180f3 100644 --- a/src/gx/main.go +++ b/src/gx/main.go @@ -66,6 +66,7 @@ func (e *Engine) Add(l Layer, b any) { beh, ok := b.(Behaver) if ok { e.AddBehaver(beh) + beh.Start(e) } drw, ok := b.(Drawer) diff --git a/src/gx/transform.go b/src/gx/transform.go index ca3165c..b4b2fdc 100644 --- a/src/gx/transform.go +++ b/src/gx/transform.go @@ -18,6 +18,10 @@ type Transform struct { R Float } +func V(x, y Float) Vector { + return Vector{x, y} +} + func T() Transform { ret := Transform{} return ret