Cursor changes when tool is selected.
This commit is contained in:
parent
2f5f682a59
commit
820d0f109a
@ -107,39 +107,45 @@ func (r *terrainRenderer) Handle(ctx ui.Context, event ui.Event) bool {
|
||||
}
|
||||
}
|
||||
|
||||
if r.hover != nil && r.game.Tool().Type() == "plant-flower" {
|
||||
terrain := r.game.Terrain
|
||||
temp := func() string {
|
||||
temp := terrain.Temp.Value(r.hover.X, r.hover.Y)
|
||||
switch {
|
||||
case temp < .3:
|
||||
return "very cold"
|
||||
case temp < .4:
|
||||
return "cold"
|
||||
case temp > .7:
|
||||
return "very hot"
|
||||
case temp > .6:
|
||||
return "hot"
|
||||
default:
|
||||
return "moderate"
|
||||
}
|
||||
}()
|
||||
humid := func() string {
|
||||
humid := terrain.Humid.Value(r.hover.X, r.hover.Y)
|
||||
switch {
|
||||
case humid < .3:
|
||||
return " and very arid"
|
||||
case humid < .4:
|
||||
return " and arid"
|
||||
case humid > .7:
|
||||
return " and very damp"
|
||||
case humid > .6:
|
||||
return " and damp"
|
||||
default:
|
||||
return ""
|
||||
}
|
||||
}()
|
||||
ctx.ShowTooltip(fmt.Sprintf("It is %s%s over here", temp, humid))
|
||||
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
|
||||
temp := func() string {
|
||||
temp := terrain.Temp.Value(r.hover.X, r.hover.Y)
|
||||
switch {
|
||||
case temp < .3:
|
||||
return "very cold"
|
||||
case temp < .4:
|
||||
return "cold"
|
||||
case temp > .7:
|
||||
return "very hot"
|
||||
case temp > .6:
|
||||
return "hot"
|
||||
default:
|
||||
return "moderate"
|
||||
}
|
||||
}()
|
||||
humid := func() string {
|
||||
humid := terrain.Humid.Value(r.hover.X, r.hover.Y)
|
||||
switch {
|
||||
case humid < .3:
|
||||
return " and very arid"
|
||||
case humid < .4:
|
||||
return " and arid"
|
||||
case humid > .7:
|
||||
return " and very damp"
|
||||
case humid > .6:
|
||||
return " and damp"
|
||||
default:
|
||||
return ""
|
||||
}
|
||||
}()
|
||||
ctx.ShowTooltip(fmt.Sprintf("It is %s%s over here", temp, humid))
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user