ui: Deprecate SetCursorVisibility and add SetCursorVisible (#407)

This commit is contained in:
Hajime Hoshi 2018-01-09 02:01:33 +09:00
parent 5c55df87d7
commit 38c72faf95
5 changed files with 13 additions and 8 deletions

View File

@ -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()})

View File

@ -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)

View File

@ -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")

View File

@ -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
View File

@ -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