mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-25 03:08:54 +01:00
input: Rename Reset -> ResetForFrame
This commit is contained in:
parent
9e5261c156
commit
e273618081
@ -22,6 +22,7 @@ import (
|
|||||||
"github.com/hajimehoshi/ebiten/internal/driver"
|
"github.com/hajimehoshi/ebiten/internal/driver"
|
||||||
"github.com/hajimehoshi/ebiten/internal/graphicscommand"
|
"github.com/hajimehoshi/ebiten/internal/graphicscommand"
|
||||||
"github.com/hajimehoshi/ebiten/internal/hooks"
|
"github.com/hajimehoshi/ebiten/internal/hooks"
|
||||||
|
"github.com/hajimehoshi/ebiten/internal/input"
|
||||||
"github.com/hajimehoshi/ebiten/internal/shareable"
|
"github.com/hajimehoshi/ebiten/internal/shareable"
|
||||||
"github.com/hajimehoshi/ebiten/internal/ui"
|
"github.com/hajimehoshi/ebiten/internal/ui"
|
||||||
)
|
)
|
||||||
@ -114,6 +115,8 @@ func (c *graphicsContext) Update(afterFrameUpdate func()) error {
|
|||||||
if err := c.f(c.offscreen); err != nil {
|
if err := c.f(c.offscreen); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
input.Get().ResetForFrame()
|
||||||
afterFrameUpdate()
|
afterFrameUpdate()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -47,7 +47,7 @@ func (i *Input) RuneBuffer() []rune {
|
|||||||
return i.runeBuffer
|
return i.runeBuffer
|
||||||
}
|
}
|
||||||
|
|
||||||
func (i *Input) Reset() {
|
func (i *Input) ResetForFrame() {
|
||||||
i.m.RLock()
|
i.m.RLock()
|
||||||
defer i.m.RUnlock()
|
defer i.m.RUnlock()
|
||||||
i.runeBuffer = i.runeBuffer[:0]
|
i.runeBuffer = i.runeBuffer[:0]
|
||||||
|
@ -49,7 +49,7 @@ func (i *Input) RuneBuffer() []rune {
|
|||||||
return i.runeBuffer
|
return i.runeBuffer
|
||||||
}
|
}
|
||||||
|
|
||||||
func (i *Input) Reset() {
|
func (i *Input) ResetForFrame() {
|
||||||
i.runeBuffer = nil
|
i.runeBuffer = nil
|
||||||
i.wheelX = 0
|
i.wheelX = 0
|
||||||
i.wheelY = 0
|
i.wheelY = 0
|
||||||
|
@ -57,3 +57,7 @@ func (i *Input) SetTouches(touches []*Touch) {
|
|||||||
}
|
}
|
||||||
i.m.Unlock()
|
i.m.Unlock()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (i *Input) ResetForFrame() {
|
||||||
|
// Do nothing
|
||||||
|
}
|
||||||
|
@ -780,7 +780,6 @@ func (u *userInterface) update(g GraphicsContext) error {
|
|||||||
return nil
|
return nil
|
||||||
})
|
})
|
||||||
if err := g.Update(func() {
|
if err := g.Update(func() {
|
||||||
input.Get().Reset()
|
|
||||||
// The offscreens must be updated every frame (#490).
|
// The offscreens must be updated every frame (#490).
|
||||||
u.updateGraphicsContext(g)
|
u.updateGraphicsContext(g)
|
||||||
}); err != nil {
|
}); err != nil {
|
||||||
|
@ -206,7 +206,6 @@ func (u *userInterface) update(g GraphicsContext) error {
|
|||||||
input.Get().UpdateGamepads()
|
input.Get().UpdateGamepads()
|
||||||
u.updateGraphicsContext(g)
|
u.updateGraphicsContext(g)
|
||||||
if err := g.Update(func() {
|
if err := g.Update(func() {
|
||||||
input.Get().Reset()
|
|
||||||
u.updateGraphicsContext(g)
|
u.updateGraphicsContext(g)
|
||||||
}); err != nil {
|
}); err != nil {
|
||||||
return err
|
return err
|
||||||
|
Loading…
Reference in New Issue
Block a user