mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-11-10 04:57:26 +01:00
internal/ui: update touches after the layout is determined on mobiles
Closes #2763
This commit is contained in:
parent
07d2706e63
commit
8a0aba45f5
@ -37,19 +37,27 @@ func (u *userInterfaceImpl) updateInputStateFromOutside(keys map[Key]struct{}, r
|
||||
|
||||
u.inputState.Runes = append(u.inputState.Runes, runes...)
|
||||
|
||||
u.inputState.Touches = u.inputState.Touches[:0]
|
||||
u.touches = u.touches[:0]
|
||||
for _, t := range touches {
|
||||
x, y := u.context.clientPositionToLogicalPosition(t.X, t.Y, u.DeviceScaleFactor())
|
||||
u.touches = append(u.touches, t)
|
||||
}
|
||||
}
|
||||
|
||||
func (u *userInterfaceImpl) updateInputState() error {
|
||||
u.m.Lock()
|
||||
defer u.m.Unlock()
|
||||
|
||||
s := u.DeviceScaleFactor()
|
||||
|
||||
u.inputState.Touches = u.inputState.Touches[:0]
|
||||
for _, t := range u.touches {
|
||||
x, y := u.context.clientPositionToLogicalPosition(t.X, t.Y, s)
|
||||
u.inputState.Touches = append(u.inputState.Touches, Touch{
|
||||
ID: t.ID,
|
||||
X: int(x),
|
||||
Y: int(y),
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func (u *userInterfaceImpl) updateInputState() error {
|
||||
// TODO: Adjust cursor and touch positions based on the latest layout (#2763).
|
||||
return nil
|
||||
}
|
||||
|
||||
|
@ -114,6 +114,7 @@ type userInterfaceImpl struct {
|
||||
context *context
|
||||
|
||||
inputState InputState
|
||||
touches []TouchForInput
|
||||
|
||||
fpsMode FPSModeType
|
||||
renderRequester RenderRequester
|
||||
|
Loading…
Reference in New Issue
Block a user