Skip to content

Commit

Permalink
Minor updates
Browse files Browse the repository at this point in the history
  • Loading branch information
unitoftime committed Oct 14, 2024
1 parent 20528b5 commit a6c0551
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 11 deletions.
4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,7 @@ all: test
test:
go fmt ./...
go test ./...

upgrade:
go get -u ./...
go mod tidy
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -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=
Expand Down
14 changes: 7 additions & 7 deletions render/camera.go
Original file line number Diff line number Diff line change
Expand Up @@ -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])))
Expand All @@ -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)
}
Expand All @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion x/glitchasset/load.go
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down

0 comments on commit a6c0551

Please sign in to comment.