Page 1 of 1

[kovarex] GUI graphics not behaving when using layers

Posted: Wed Aug 02, 2017 4:46 pm
by bobingabout
same mod again, updated the code though, still applies to other bug.
https://www.dropbox.com/s/1ynlcf7ej1bkv ... P.rar?dl=0

if you look in the styles.lua file, you'll see 2 blocks of code, 1 commented out.

the method I tried first was to draw the button graphics once, and use layers to overlay the icon onto the button.(That's the configuration in the file as it is) this was the result.
https://www.dropbox.com/s/v0w73ap3se9m2 ... 4.png?dl=0

As you can see, it doesn't look right.
Example snippet of the layer code:

Code: Select all

      default_graphical_set =
      {
        type = "monolith",
        monolith_image =
        {
          layers =
          {
            {
              filename = "__bobclasses__/buttons/button.png",
              priority = "extra-high-no-scale",
              load_in_minimal_mode = true,
              width = 36,
              height = 36,
            },
            {
              filename = filename,
              priority = "extra-high-no-scale",
              load_in_minimal_mode = true,
              width = 32,
              height = 32,
              shift = {2, 2}
            }
          }
        }
      },

As a result, I then went and edited the graphics so each button had it's own set of image files. (commented out in the mod), this is the result.
https://www.dropbox.com/s/wi2v1633a22ae ... 8.png?dl=0

As you can see, everything looks as you would expect.


Am I doing something wrong, or is this some sort of bug?

Re: GUI graphics not behaving when using layers

Posted: Thu Sep 07, 2017 10:30 am
by kovarex
The layers should be fixed, but also, for this case you should definetly use the sprite-button right?
http://lua-api.factorio.com/latest/LuaGuiElement.html

With the sprite button, you can set any image to the button in runtime without having to set special style for it.
Also, apart custom images, you can use generic names like "item/iron-plate" etc. (http://lua-api.factorio.com/latest/Conc ... SpritePath)

Re: [kovarex] GUI graphics not behaving when using layers

Posted: Thu Sep 07, 2017 5:01 pm
by kovarex
I checked the layers in the styles and .. well I spent like 5 hours with that and and figured out all the problems related to sprites and gui, so I'm going to say, just use the sprite button and don't use layers in styles and lets call it a day :)