mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-25 19:28:57 +01:00
ui: Add AdjustedTouches for consistency
This commit is contained in:
parent
e44a930bbb
commit
c540d0fc0d
2
input.go
2
input.go
@ -119,7 +119,7 @@ type Touch interface {
|
|||||||
//
|
//
|
||||||
// Touches always returns nil on desktops.
|
// Touches always returns nil on desktops.
|
||||||
func Touches() []Touch {
|
func Touches() []Touch {
|
||||||
t := input.Get().Touches()
|
t := ui.AdjustedTouches()
|
||||||
tt := make([]Touch, len(t))
|
tt := make([]Touch, len(t))
|
||||||
for i := 0; i < len(tt); i++ {
|
for i := 0; i < len(tt); i++ {
|
||||||
tt[i] = t[i]
|
tt[i] = t[i]
|
||||||
|
@ -366,6 +366,11 @@ func adjustCursorPosition(x, y int) (int, int) {
|
|||||||
return x - int(ox/s), y - int(oy/s)
|
return x - int(ox/s), y - int(oy/s)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func AdjustedTouches() []*input.Touch {
|
||||||
|
// TODO: Apply adjustCursorPosition
|
||||||
|
return input.Get().Touches()
|
||||||
|
}
|
||||||
|
|
||||||
func IsCursorVisible() bool {
|
func IsCursorVisible() bool {
|
||||||
u := currentUI
|
u := currentUI
|
||||||
if !u.isRunning() {
|
if !u.isRunning() {
|
||||||
|
@ -86,6 +86,11 @@ func AdjustedCursorPosition() (x, y int) {
|
|||||||
return int(float64(x) / scale), int(float64(y) / scale)
|
return int(float64(x) / scale), int(float64(y) / scale)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func AdjustedTouches() []*input.Touch {
|
||||||
|
// TODO: Apply adjustment here
|
||||||
|
return input.Get().Touches()
|
||||||
|
}
|
||||||
|
|
||||||
func IsCursorVisible() bool {
|
func IsCursorVisible() bool {
|
||||||
// The initial value is an empty string, so don't compare with "auto" here.
|
// The initial value is an empty string, so don't compare with "auto" here.
|
||||||
return canvas.Get("style").Get("cursor").String() != "none"
|
return canvas.Get("style").Get("cursor").String() != "none"
|
||||||
|
@ -242,6 +242,11 @@ func AdjustedCursorPosition() (x, y int) {
|
|||||||
return currentUI.adjustCursorPosition(input.Get().CursorPosition())
|
return currentUI.adjustCursorPosition(input.Get().CursorPosition())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func AdjustedTouches() []*input.Touch {
|
||||||
|
// TODO: Apply adjustment here
|
||||||
|
return input.Get().Touches()
|
||||||
|
}
|
||||||
|
|
||||||
func (u *userInterface) adjustCursorPosition(x, y int) (int, int) {
|
func (u *userInterface) adjustCursorPosition(x, y int) (int, int) {
|
||||||
u.m.Lock()
|
u.m.Lock()
|
||||||
ox, oy, _, _ := u.screenPaddingImpl()
|
ox, oy, _, _ := u.screenPaddingImpl()
|
||||||
|
Loading…
Reference in New Issue
Block a user