Made settings button disabled for now.
This commit is contained in:
parent
8236b65c06
commit
bfe0c9003d
8
color.go
8
color.go
@ -11,6 +11,14 @@ var Transparent = sdl.Color{R: 0, G: 0, B: 0, A: 0}
|
||||
var TransparentWhite = sdl.Color{R: 255, G: 255, B: 255, A: 31}
|
||||
var White = sdl.Color{R: 255, G: 255, B: 255, A: 255}
|
||||
|
||||
func HexColor(s string) (sdl.Color, error) {
|
||||
c, err := img.HexColor(s)
|
||||
if err != nil {
|
||||
return sdl.Color{}, err
|
||||
}
|
||||
return sdl.Color(c), nil
|
||||
}
|
||||
|
||||
func MustHexColor(s string) sdl.Color { return sdl.Color(img.MustHexColor(s)) }
|
||||
|
||||
func SetDrawColor(renderer *sdl.Renderer, color sdl.Color) {
|
||||
|
@ -120,7 +120,10 @@ func (c *GameControls) Init(ctx *Context) error {
|
||||
|
||||
c.menu.Background = MustHexColor("#356dad")
|
||||
c.menu.Buttons = []Control{
|
||||
NewIconButton("control-settings", c.dialogs.ShowSettings),
|
||||
NewIconButtonConfig("control-settings", c.dialogs.ShowSettings, func(b *IconButton) {
|
||||
b.IsDisabled = true
|
||||
b.IconDisabled = "#afafaf"
|
||||
}),
|
||||
NewIconButton("control-save", func(*Context) { c.game.Save() }),
|
||||
NewIconButton("control-load", func(ctx *Context) {
|
||||
c.game.Load()
|
||||
|
@ -43,6 +43,16 @@ func (b *IconButton) activeTexture(ctx *Context) *Texture {
|
||||
if texture != nil {
|
||||
return texture
|
||||
}
|
||||
|
||||
texture = ctx.Textures.Texture(b.Icon)
|
||||
if len(b.IconDisabled) == 0 {
|
||||
return texture
|
||||
}
|
||||
color, err := HexColor(b.IconDisabled)
|
||||
if err == nil {
|
||||
texture.SetColor(color)
|
||||
}
|
||||
return texture
|
||||
}
|
||||
return ctx.Textures.Texture(b.Icon)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user