This commit is contained in:
Andrey Parhomenko 2024-01-04 17:05:51 +03:00
parent 2821ffd442
commit 3f441641e4
6 changed files with 14 additions and 15 deletions

View file

@ -1,6 +1,6 @@
package main
import "github.com/di4f/gg"
import "github.com/vultras/gg"
import (
"strings"

View file

@ -1,7 +1,7 @@
package main
import (
"github.com/di4f/gg"
"github.com/vultras/gg"
"github.com/hajimehoshi/ebiten/v2/examples/resources/images"
"bytes"
"log"

View file

@ -5,7 +5,7 @@ import (
"fmt"
)
import "github.com/di4f/gg"
import "github.com/vultras/gg"
type Player struct {
gg.Sprite
@ -60,8 +60,8 @@ func (p *Player) Update(c *Context) {
//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.KeyQ:
p.Scale = p.Scale.Add(gg.V(p.ScaleSpeed*dt, 0))
case gg.KeyArrowUp:
cam.Position.Y += p.MoveSpeed * dt
case gg.KeyArrowLeft:
@ -131,17 +131,16 @@ func (p *Player) Event(c *gg.Context) {
p.Layer = HighestL
}
}
case *gg.MouseMove :
case *gg.MouseMove:
if !c.IsButtoned(gg.MouseButtonRight) {
break
}
pos := c.Camera.Position
c.Camera.Position = pos.Sub(ec.Abs)
case *gg.WheelChange :
case *gg.WheelChange:
c.Camera.Scale = c.Camera.Scale.Add(gg.V2(
ec.Offset.Y * c.DT() * p.ScaleSpeed * 40,
))
}
}

View file

@ -1,6 +1,6 @@
package main
import "github.com/di4f/gg"
import "github.com/vultras/gg"
type Rect struct {
gg.DrawableRectangle

View file

@ -1,6 +1,6 @@
package main
import "github.com/di4f/gg"
import "github.com/vultras/gg"
import "fmt"
type Tri struct {
@ -41,20 +41,20 @@ func (t *Tri) Update(c *Context) {
if c.IsPressed(gg.KeyM) {
absPos := tri.AbsPosition()
tri.SetAbsPosition(
absPos.Add(gg.V(0, 100 * c.DT() * d)),
absPos.Add(gg.V(0, 100*c.DT()*d)),
)
}
if c.IsPressed(gg.KeyN) {
absPos := tri.AbsPosition()
tri.SetAbsPosition(
absPos.Add(gg.V(100 * c.DT() * d, 0)),
absPos.Add(gg.V(100*c.DT()*d, 0)),
)
}
}
func (t *Tri) Event(c *Context) {
switch e := c.Event.(type) {
case *gg.KeyDown :
case *gg.KeyDown:
if e.Key != gg.Key1 {
break
}

2
go.mod
View file

@ -1,4 +1,4 @@
module github.com/di4f/gg
module github.com/vultras/gg
go 1.21