...
This commit is contained in:
parent
2821ffd442
commit
3f441641e4
6 changed files with 14 additions and 15 deletions
|
@ -1,6 +1,6 @@
|
|||
package main
|
||||
|
||||
import "github.com/di4f/gg"
|
||||
import "github.com/vultras/gg"
|
||||
|
||||
import (
|
||||
"strings"
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -5,7 +5,7 @@ import (
|
|||
"fmt"
|
||||
)
|
||||
|
||||
import "github.com/di4f/gg"
|
||||
import "github.com/vultras/gg"
|
||||
|
||||
type Player struct {
|
||||
gg.Sprite
|
||||
|
@ -22,7 +22,7 @@ func NewPlayer() *Player {
|
|||
ret.Scale = gg.V2(1)
|
||||
// Around center.
|
||||
ret.Around = gg.V2(.5)
|
||||
ret.MoveSpeed = 90.
|
||||
ret.MoveSpeed = 90.
|
||||
ret.ScaleSpeed = .2
|
||||
|
||||
ret.Visible = true
|
||||
|
@ -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,
|
||||
))
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package main
|
||||
|
||||
import "github.com/di4f/gg"
|
||||
import "github.com/vultras/gg"
|
||||
|
||||
type Rect struct {
|
||||
gg.DrawableRectangle
|
||||
|
|
|
@ -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
2
go.mod
|
@ -1,4 +1,4 @@
|
|||
module github.com/di4f/gg
|
||||
module github.com/vultras/gg
|
||||
|
||||
go 1.21
|
||||
|
||||
|
|
Loading…
Reference in a new issue