Cursor changes when tool is selected.

This commit is contained in:
Sander Schobers 2020-05-23 16:03:18 +02:00
parent 2f5f682a59
commit 820d0f109a

View File

@ -107,7 +107,12 @@ func (r *terrainRenderer) Handle(ctx ui.Context, event ui.Event) bool {
} }
} }
if r.hover != nil && r.game.Tool().Type() == "plant-flower" { tool := r.game.Tool().Type()
if r.hover != nil {
if tool != "none" {
ctx.Renderer().SetMouseCursor(ui.MouseCursorPointer)
}
if tool == "plant-flower" {
terrain := r.game.Terrain terrain := r.game.Terrain
temp := func() string { temp := func() string {
temp := terrain.Temp.Value(r.hover.X, r.hover.Y) temp := terrain.Temp.Value(r.hover.X, r.hover.Y)
@ -141,6 +146,7 @@ func (r *terrainRenderer) Handle(ctx ui.Context, event ui.Event) bool {
}() }()
ctx.ShowTooltip(fmt.Sprintf("It is %s%s over here", temp, humid)) ctx.ShowTooltip(fmt.Sprintf("It is %s%s over here", temp, humid))
} }
}
return false return false
} }