Page 1 of 1

Sprite button GUI: sprite layers as icon layers

Posted: Tue Dec 12, 2017 8:24 pm
by darkfrei
Hi all!

If I want to add sprite-button, then I write it so:

Code: Select all

items_table.add{
  type = "sprite-button", 
  style = "slot_button_style",  
  name = item_name, 
  sprite  = "item/" .. item_name
}
Is it possible to add layers, something like it was added by icons?

Code: Select all

icons = {
  {icon = "__mod-name__/graphics/icons/item-001.png", tint = {r = 0.8, g = 0.8, b = 1, a = 1}},
  {icon = "__mod-name__/graphics/icons/item-002.png", tint = {r = 1, g = 0.8, b = 1, a = 1}}
}
So, the code for sprite button with multiple layers looks like:

Code: Select all

items_table.add{
  type = "sprite-button", 
  style = "slot_button_style",  
  name = item_name, 
  sprites  = {
    {sprite = "item/" .. item_name},
    {sprite = "__mod-name__/graphics/icons/symbol-001.png"}
  }
}
Where symbol-001.png is a picture 32x32, something like
disabled.png
disabled.png (733 Bytes) Viewed 880 times
or

Code: Select all

  sprites  = {
    {sprite = "item/" .. item_name},
    {sprite = "item/" .. item_with_disabling_icon}
  }