mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-24 18:58:54 +01:00
ui: Deprecate SetCursorVisibility and add SetCursorVisible (#407)
This commit is contained in:
parent
5c55df87d7
commit
38c72faf95
@ -131,7 +131,7 @@ func update(screen *ebiten.Image) error {
|
|||||||
ebiten.SetScreenScale(screenScale)
|
ebiten.SetScreenScale(screenScale)
|
||||||
ebiten.SetFullscreen(fullscreen)
|
ebiten.SetFullscreen(fullscreen)
|
||||||
ebiten.SetRunnableInBackground(runnableInBackground)
|
ebiten.SetRunnableInBackground(runnableInBackground)
|
||||||
ebiten.SetCursorVisibility(cursorVisible)
|
ebiten.SetCursorVisible(cursorVisible)
|
||||||
|
|
||||||
if keyStates[ebiten.KeyI] == 1 {
|
if keyStates[ebiten.KeyI] == 1 {
|
||||||
ebiten.SetWindowIcon([]image.Image{createRandomIconImage()})
|
ebiten.SetWindowIcon([]image.Image{createRandomIconImage()})
|
||||||
|
@ -345,7 +345,7 @@ func IsCursorVisible() bool {
|
|||||||
return v
|
return v
|
||||||
}
|
}
|
||||||
|
|
||||||
func SetCursorVisibility(visible bool) {
|
func SetCursorVisible(visible bool) {
|
||||||
u := currentUI
|
u := currentUI
|
||||||
if !u.isRunning() {
|
if !u.isRunning() {
|
||||||
u.setInitCursorVisible(visible)
|
u.setInitCursorVisible(visible)
|
||||||
|
@ -86,8 +86,8 @@ func IsCursorVisible() bool {
|
|||||||
return canvas.Get("style").Get("cursor").String() != "none"
|
return canvas.Get("style").Get("cursor").String() != "none"
|
||||||
}
|
}
|
||||||
|
|
||||||
func SetCursorVisibility(visibility bool) {
|
func SetCursorVisible(visible bool) {
|
||||||
if visibility {
|
if visible {
|
||||||
canvas.Get("style").Set("cursor", "auto")
|
canvas.Get("style").Set("cursor", "auto")
|
||||||
} else {
|
} else {
|
||||||
canvas.Get("style").Set("cursor", "none")
|
canvas.Get("style").Set("cursor", "none")
|
||||||
|
@ -162,7 +162,7 @@ func IsCursorVisible() bool {
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
func SetCursorVisibility(visibility bool) {
|
func SetCursorVisible(visible bool) {
|
||||||
// Do nothing
|
// Do nothing
|
||||||
}
|
}
|
||||||
|
|
||||||
|
11
run.go
11
run.go
@ -187,13 +187,18 @@ func IsCursorVisible() bool {
|
|||||||
return ui.IsCursorVisible()
|
return ui.IsCursorVisible()
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetCursorVisibility changes the state of cursor visiblity.
|
// SetCursorVisible changes the state of cursor visiblity.
|
||||||
//
|
//
|
||||||
// SetCursorVisibility does nothing on mobiles.
|
// SetCursorVisible does nothing on mobiles.
|
||||||
//
|
//
|
||||||
// This function is concurrent-safe.
|
// This function is concurrent-safe.
|
||||||
|
func SetCursorVisible(visible bool) {
|
||||||
|
ui.SetCursorVisible(visible)
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetCursorVisibility is deprecated as of 1.6.0-alpha. Use SetCursorVisible instead.
|
||||||
func SetCursorVisibility(visible bool) {
|
func SetCursorVisibility(visible bool) {
|
||||||
ui.SetCursorVisibility(visible)
|
SetCursorVisible(visible)
|
||||||
}
|
}
|
||||||
|
|
||||||
// IsFullscreen returns a boolean value indicating whether
|
// IsFullscreen returns a boolean value indicating whether
|
||||||
|
Loading…
Reference in New Issue
Block a user