mirror of
https://github.com/charmbracelet/harmonica.git
synced 2026-07-20 02:29:33 -06:00
Tidy up visual example
This commit is contained in:
parent
f621791e1c
commit
3bece8a812
@ -141,14 +141,11 @@ func (g *Game) Update() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if released(pixelgl.MouseButtonLeft) {
|
if released(pixelgl.MouseButtonLeft) {
|
||||||
s := g.sprite
|
if g.sprite == nil {
|
||||||
|
|
||||||
if s == nil {
|
|
||||||
g.sprite = NewSprite(g)
|
g.sprite = NewSprite(g)
|
||||||
} else {
|
} else {
|
||||||
x, y := g.MousePosition()
|
s := g.sprite
|
||||||
s.TargetX = x
|
s.TargetX, s.TargetY = g.MousePosition()
|
||||||
s.TargetY = y
|
|
||||||
|
|
||||||
switch s.State() {
|
switch s.State() {
|
||||||
case hiding, gone:
|
case hiding, gone:
|
||||||
@ -156,7 +153,6 @@ func (g *Game) Update() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
g.dirty = false
|
|
||||||
g.lastClick = time.Now()
|
g.lastClick = time.Now()
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -255,9 +251,7 @@ func (s *Sprite) Update() {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
g := s.game
|
if s.game.dirty {
|
||||||
|
|
||||||
if g.dirty {
|
|
||||||
// Recompute spring coefficients since our frequency or damping has
|
// Recompute spring coefficients since our frequency or damping has
|
||||||
// changed.
|
// changed.
|
||||||
s.computeSpring()
|
s.computeSpring()
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user