mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-24 10:48:53 +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/graphicscommand"
|
||||
"github.com/hajimehoshi/ebiten/internal/hooks"
|
||||
"github.com/hajimehoshi/ebiten/internal/input"
|
||||
"github.com/hajimehoshi/ebiten/internal/shareable"
|
||||
"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 {
|
||||
return err
|
||||
}
|
||||
|
||||
input.Get().ResetForFrame()
|
||||
afterFrameUpdate()
|
||||
}
|
||||
|
||||
|
@ -47,7 +47,7 @@ func (i *Input) RuneBuffer() []rune {
|
||||
return i.runeBuffer
|
||||
}
|
||||
|
||||
func (i *Input) Reset() {
|
||||
func (i *Input) ResetForFrame() {
|
||||
i.m.RLock()
|
||||
defer i.m.RUnlock()
|
||||
i.runeBuffer = i.runeBuffer[:0]
|
||||
|
@ -49,7 +49,7 @@ func (i *Input) RuneBuffer() []rune {
|
||||
return i.runeBuffer
|
||||
}
|
||||
|
||||
func (i *Input) Reset() {
|
||||
func (i *Input) ResetForFrame() {
|
||||
i.runeBuffer = nil
|
||||
i.wheelX = 0
|
||||
i.wheelY = 0
|
||||
|
@ -57,3 +57,7 @@ func (i *Input) SetTouches(touches []*Touch) {
|
||||
}
|
||||
i.m.Unlock()
|
||||
}
|
||||
|
||||
func (i *Input) ResetForFrame() {
|
||||
// Do nothing
|
||||
}
|
||||
|
@ -780,7 +780,6 @@ func (u *userInterface) update(g GraphicsContext) error {
|
||||
return nil
|
||||
})
|
||||
if err := g.Update(func() {
|
||||
input.Get().Reset()
|
||||
// The offscreens must be updated every frame (#490).
|
||||
u.updateGraphicsContext(g)
|
||||
}); err != nil {
|
||||
|
@ -206,7 +206,6 @@ func (u *userInterface) update(g GraphicsContext) error {
|
||||
input.Get().UpdateGamepads()
|
||||
u.updateGraphicsContext(g)
|
||||
if err := g.Update(func() {
|
||||
input.Get().Reset()
|
||||
u.updateGraphicsContext(g)
|
||||
}); err != nil {
|
||||
return err
|
||||
|
Loading…
Reference in New Issue
Block a user