mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-24 02:38:53 +01:00
internal/ui: bug fix: reset the input state immediately after reading
Before this change, the input state was reset at the end of a tick. This means that wheel deltas or input chars in a tick might be reset unexpectedly. This change fixes the issue by reseting the input state immediately when reading, so that wheel events and input-char events are preserved. Updates #2496 Updates #2501
This commit is contained in:
parent
f989f8a9fa
commit
a5b6f39ed7
@ -1411,13 +1411,13 @@ func (u *userInterfaceImpl) resetForTick() {
|
||||
u.m.Lock()
|
||||
defer u.m.Unlock()
|
||||
u.windowBeingClosed = false
|
||||
u.inputState.resetForTick()
|
||||
}
|
||||
|
||||
func (u *userInterfaceImpl) readInputState(inputState *InputState) {
|
||||
u.m.Lock()
|
||||
defer u.m.Unlock()
|
||||
*inputState = u.inputState
|
||||
u.inputState.resetForTick()
|
||||
}
|
||||
|
||||
func (u *userInterfaceImpl) Window() Window {
|
||||
|
@ -682,10 +682,10 @@ func (u *userInterfaceImpl) SetScreenTransparent(transparent bool) {
|
||||
|
||||
func (u *userInterfaceImpl) readInputState(inputState *InputState) {
|
||||
*inputState = u.inputState
|
||||
u.inputState.resetForTick()
|
||||
}
|
||||
|
||||
func (u *userInterfaceImpl) resetForTick() {
|
||||
u.inputState.resetForTick()
|
||||
}
|
||||
|
||||
func (u *userInterfaceImpl) Window() Window {
|
||||
|
@ -422,12 +422,10 @@ func (u *userInterfaceImpl) readInputState(inputState *InputState) {
|
||||
u.m.Lock()
|
||||
defer u.m.Unlock()
|
||||
*inputState = u.inputState
|
||||
u.inputState.resetForTick()
|
||||
}
|
||||
|
||||
func (u *userInterfaceImpl) resetForTick() {
|
||||
u.m.Lock()
|
||||
defer u.m.Unlock()
|
||||
u.inputState.resetForTick()
|
||||
}
|
||||
|
||||
func (u *userInterfaceImpl) Window() Window {
|
||||
|
@ -94,10 +94,10 @@ func (*userInterfaceImpl) ScreenSizeInFullscreen() (int, int) {
|
||||
|
||||
func (u *userInterfaceImpl) readInputState(inputState *InputState) {
|
||||
*inputState = u.inputState
|
||||
u.inputState.resetForTick()
|
||||
}
|
||||
|
||||
func (u *userInterfaceImpl) resetForTick() {
|
||||
u.inputState.resetForTick()
|
||||
}
|
||||
|
||||
func (*userInterfaceImpl) CursorMode() CursorMode {
|
||||
|
Loading…
Reference in New Issue
Block a user