From a6c05518df17f5d5336705a04b6ec7b3bfcec353 Mon Sep 17 00:00:00 2001 From: Jacob <2606873+unitoftime@users.noreply.github.com> Date: Mon, 14 Oct 2024 15:08:21 -0400 Subject: [PATCH] Minor updates --- Makefile | 4 ++++ go.mod | 2 +- go.sum | 4 ++-- render/camera.go | 14 +++++++------- x/glitchasset/load.go | 2 +- 5 files changed, 15 insertions(+), 11 deletions(-) diff --git a/Makefile b/Makefile index 6325ba2..a5d06ae 100644 --- a/Makefile +++ b/Makefile @@ -3,3 +3,7 @@ all: test test: go fmt ./... go test ./... + +upgrade: + go get -u ./... + go mod tidy diff --git a/go.mod b/go.mod index ded09e5..5d69c11 100644 --- a/go.mod +++ b/go.mod @@ -10,7 +10,7 @@ require ( github.com/ungerik/go3d v0.0.0-20240502073936-1137f6adf7e9 github.com/unitoftime/beep v0.0.0-20230919175050-aed291a2afca github.com/unitoftime/ecs v0.0.1 - github.com/unitoftime/glitch v0.0.0-20241013142148-faeeba66aac2 + github.com/unitoftime/glitch v0.0.0-20241014190205-a6252a015687 github.com/unitoftime/gotiny v0.0.0-20240915162236-e7a35021e769 github.com/unitoftime/intmap v0.0.0-20231203115433-9505126f7096 github.com/unitoftime/packer v0.0.0-20230818221437-1f2c1b1e4275 diff --git a/go.sum b/go.sum index 1674b95..b5e9688 100644 --- a/go.sum +++ b/go.sum @@ -33,8 +33,8 @@ github.com/unitoftime/cod v0.0.0-20240909130117-f553b1d09d22 h1:81V+30jfwHH0wAsO github.com/unitoftime/cod v0.0.0-20240909130117-f553b1d09d22/go.mod h1:Iufibv9gn5GJb4Qzkf8e8xaXOV77OgkrB5kkBZTEN+M= github.com/unitoftime/ecs v0.0.1 h1:xYxtSz99Ys5Cd/BgA54/ajC9Rp3t4tGmcM7Q8uIeDMc= github.com/unitoftime/ecs v0.0.1/go.mod h1:3i8ercdQPj5M8lq9B3qGjywG7RRq0tBjbP/7THI5mtc= -github.com/unitoftime/glitch v0.0.0-20241013142148-faeeba66aac2 h1:u/xRSkKlurKoF48wi9VZLAy/62kN/ISuabZig/GFvyQ= -github.com/unitoftime/glitch v0.0.0-20241013142148-faeeba66aac2/go.mod h1:6sPh1f1Qcg/H8Rn4TreWUJ6j3r/29iLV2B2y0ArmCSA= +github.com/unitoftime/glitch v0.0.0-20241014190205-a6252a015687 h1:CpcCn6EdqB3zdm6v4TfvbMDhy1sI5Dxh0gJ5v+5clds= +github.com/unitoftime/glitch v0.0.0-20241014190205-a6252a015687/go.mod h1:PgbLZ67AMiBoKS6FvFIVM0ANTRmU1wLKJEufxTsZ6vg= github.com/unitoftime/gotiny v0.0.0-20240915162236-e7a35021e769 h1:SjK7DZ+RQcLLZwuz9bOLPW59fAZfadztDFDVg3nSiCE= github.com/unitoftime/gotiny v0.0.0-20240915162236-e7a35021e769/go.mod h1:iq4kY4pPC8ZKztyei1pln4Fkk0BxQbyM1hICubHxoCo= github.com/unitoftime/intmap v0.0.0-20231203115433-9505126f7096 h1:ietNpHDGnFAyabqzzinz8zJW2rjx/0DLslU4hU4wNbU= diff --git a/render/camera.go b/render/camera.go index c23c506..11b8507 100644 --- a/render/camera.go +++ b/render/camera.go @@ -9,21 +9,21 @@ import ( type Camera struct { Camera *glitch.CameraOrtho - Position glitch.Vec2 + Position glm.Vec2 Zoom float64 - bounds glitch.Rect + bounds glm.Rect } -func NewCamera(bounds glitch.Rect, x, y float64) *Camera { +func NewCamera(bounds glm.Rect, x, y float64) *Camera { return &Camera{ Camera: glitch.NewCameraOrtho(), - Position: glitch.Vec2{x, y}, + Position: glm.Vec2{x, y}, Zoom: 1.0, bounds: bounds, } } -func (c *Camera) Update(bounds glitch.Rect) { +func (c *Camera) Update(bounds glm.Rect) { // // Snap camera // c.Position[0] = float32(math.Round(float64(c.Position[0]))) // c.Position[1] = float32(math.Round(float64(c.Position[1]))) @@ -34,7 +34,7 @@ func (c *Camera) Update(bounds glitch.Rect) { screenCenter := bounds.Center() c.Camera.SetOrtho2D(bounds) - movePos := glitch.Vec2{c.Position.X, c.Position.Y}.Sub(screenCenter) + movePos := glm.Vec2{c.Position.X, c.Position.Y}.Sub(screenCenter) c.Camera.SetView2D(movePos.X, movePos.Y, c.Zoom, c.Zoom) } @@ -47,7 +47,7 @@ func (c *Camera) Unproject(point glitch.Vec3) glitch.Vec3 { return c.Camera.Unproject(point) } -func (c *Camera) WorldSpaceRect() glitch.Rect { +func (c *Camera) WorldSpaceRect() glm.Rect { box := c.bounds.ToBox() min := c.Unproject(box.Min) max := c.Unproject(box.Max) diff --git a/x/glitchasset/load.go b/x/glitchasset/load.go index d071420..cd6b999 100644 --- a/x/glitchasset/load.go +++ b/x/glitchasset/load.go @@ -281,7 +281,7 @@ func (s *Spritesheet) Get(name string) (*glitch.Sprite, error) { } // https://www.aseprite.org/docs/slices/#:~:text=With%20the%20Slice%20tool,some%20extra%20user%20defined%20information. -func (s *Spritesheet) GetNinePanel(name string, border glitch.Rect) (*glitch.NinePanelSprite, error) { +func (s *Spritesheet) GetNinePanel(name string, border glm.Rect) (*glitch.NinePanelSprite, error) { sprite, ok := s.lookup[name] if !ok { return nil, errors.New(fmt.Sprintf("Invalid sprite name: %s", name))