mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-11-10 04:57:26 +01:00
uidriver: Copy the runes on the callee sides
This commit is contained in:
parent
82dc7a6591
commit
14070ee153
3
input.go
3
input.go
@ -32,8 +32,7 @@ import (
|
||||
//
|
||||
// Keyboards don't work on iOS yet (#1090).
|
||||
func InputChars() []rune {
|
||||
rb := uiDriver().Input().RuneBuffer()
|
||||
return append(make([]rune, 0, len(rb)), rb...)
|
||||
return uiDriver().Input().RuneBuffer()
|
||||
}
|
||||
|
||||
// IsKeyPressed returns a boolean indicating whether key is pressed.
|
||||
|
@ -218,7 +218,8 @@ func (i *Input) RuneBuffer() []rune {
|
||||
}
|
||||
var r []rune
|
||||
_ = i.ui.t.Call(func() error {
|
||||
r = i.runeBuffer
|
||||
r = make([]rune, len(i.runeBuffer))
|
||||
copy(r, i.runeBuffer)
|
||||
return nil
|
||||
})
|
||||
return r
|
||||
|
@ -142,7 +142,9 @@ func (i *Input) TouchPosition(id driver.TouchID) (x, y int) {
|
||||
}
|
||||
|
||||
func (i *Input) RuneBuffer() []rune {
|
||||
return i.runeBuffer
|
||||
rs := make([]rune, len(i.runeBuffer))
|
||||
copy(rs, i.runeBuffer)
|
||||
return rs
|
||||
}
|
||||
|
||||
func (i *Input) resetForFrame() {
|
||||
|
@ -164,7 +164,9 @@ func (i *Input) TouchPosition(id driver.TouchID) (x, y int) {
|
||||
}
|
||||
|
||||
func (i *Input) RuneBuffer() []rune {
|
||||
return i.runes
|
||||
rs := make([]rune, len(i.runes))
|
||||
copy(rs, i.runes)
|
||||
return rs
|
||||
}
|
||||
|
||||
func (i *Input) IsKeyPressed(key driver.Key) bool {
|
||||
|
Loading…
Reference in New Issue
Block a user