From 2821ffd44219064cb581797c63dc960b38ed9d05 Mon Sep 17 00:00:00 2001 From: surdeus Date: Thu, 28 Dec 2023 14:34:52 +0300 Subject: [PATCH] ... --- cmd/test/player.go | 13 ++++++++----- cmd/test/trianlge.go | 2 +- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/cmd/test/player.go b/cmd/test/player.go index 49de557..6e76132 100644 --- a/cmd/test/player.go +++ b/cmd/test/player.go @@ -56,9 +56,12 @@ func (p *Player) Update(c *Context) { cam := c.Camera keys := c.Keys() + shift := c.IsPressed(gg.KeyShift) //p.Uniforms["Random"] = any(rand.Float32()) for _, v := range keys { switch v { + case gg.KeyQ : + p.Scale = p.Scale.Add(gg.V(p.ScaleSpeed * dt, 0)) case gg.KeyArrowUp: cam.Position.Y += p.MoveSpeed * dt case gg.KeyArrowLeft: @@ -80,31 +83,31 @@ func (p *Player) Update(c *Context) { case gg.KeyT: cam.Rotation -= gg.Pi * p.ScaleSpeed * dt case gg.KeyRightBracket: - if c.IsPressed(gg.KeyShift) { + if shift { p.Rotation -= gg.Pi * 0.3 * dt } else { p.Rotation += gg.Pi * 0.3 * dt } case gg.KeyF: - if c.IsPressed(gg.KeyShift) { + if shift { cam.Scale = cam.Scale.Add(gg.V2(p.ScaleSpeed * dt)) } else { cam.Scale = cam.Scale.Add(gg.V2(-p.ScaleSpeed * dt)) } case gg.KeyG: - if c.IsPressed(gg.KeyShift) { + if shift { cam.Scale.Y -= gg.Pi * p.ScaleSpeed * dt } else { cam.Scale.Y += gg.Pi * p.ScaleSpeed * dt } case gg.KeyV: - if c.IsPressed(gg.KeyShift) { + if shift { tri.Rotation -= gg.Pi * 0.3 * dt } else { tri.Rotation += gg.Pi * 0.3 * dt } case gg.KeyLeftBracket: - if c.IsPressed(gg.KeyShift) { + if shift { rect.Rotation -= gg.Pi * 0.3 * dt } else { rect.Rotation += gg.Pi * 0.3 * dt diff --git a/cmd/test/trianlge.go b/cmd/test/trianlge.go index c143289..4fe5fea 100644 --- a/cmd/test/trianlge.go +++ b/cmd/test/trianlge.go @@ -10,7 +10,6 @@ type Tri struct { func NewTri() *Tri { ret := &Tri{} - ret.Parent = player ret.Transform.Scale = gg.V2(1) ret.Triangles = gg.Triangles{ @@ -23,6 +22,7 @@ func NewTri() *Tri { ret.Color = gg.Rgba(1, 1, 0, 1) ret.Visible = true ret.Layer = TriangleL + ret.Connect(player) return ret }