Mod-GUI: Changeable background

Place to ask discuss and request the modding support of Factorio. Don't request mods here.
Post Reply
User avatar
Godmave
Long Handed Inserter
Long Handed Inserter
Posts: 89
Joined: Tue Nov 15, 2016 3:52 pm
Contact:

Mod-GUI: Changeable background

Post by Godmave »

Allow us to change the background of elements (labels, panes, etc.)

The easy way via background_color (rgba).
The more complicated way via background-tile / background-transparency (sprite getting repeated to fill the area)

Bilka
Factorio Staff
Factorio Staff
Posts: 3130
Joined: Sat Aug 13, 2016 9:20 am
Contact:

Re: Mod-GUI: Changeable background

Post by Bilka »

This is already possible with styles: viewtopic.php?f=65&t=57787
I'm an admin over at https://wiki.factorio.com. Feel free to contact me if there's anything wrong (or right) with it.

User avatar
Godmave
Long Handed Inserter
Long Handed Inserter
Posts: 89
Joined: Tue Nov 15, 2016 3:52 pm
Contact:

Re: Mod-GUI: Changeable background

Post by Godmave »

Nope, sadly not. The only thing that allows background is the list-box. Which is not available to mods.
Klonan even said so in the mod-making discord ;)
Klonan - Last Sunday at 4:11 PM
however, background color cannot be changed

Bilka
Factorio Staff
Factorio Staff
Posts: 3130
Joined: Sat Aug 13, 2016 9:20 am
Contact:

Re: Mod-GUI: Changeable background

Post by Bilka »

Godmave wrote:Nope, sadly not. The only thing that allows background is the list-box. Which is not available to mods.
Klonan even said so in the mod-making discord ;)
Then how do you explain the screenshot in the other post? That person is rather obviously using styles to change the background.
I'm an admin over at https://wiki.factorio.com. Feel free to contact me if there's anything wrong (or right) with it.

User avatar
Godmave
Long Handed Inserter
Long Handed Inserter
Posts: 89
Joined: Tue Nov 15, 2016 3:52 pm
Contact:

Re: Mod-GUI: Changeable background

Post by Godmave »

So you can change the graphical_set, mhh. That would help at least for hard-mods. That would also explain why you can't simply change the background color of things, since the background is an image, not a filled area.
But labels don't have that I think. Will take a longer look in the evening after work.

User avatar
Klonan
Factorio Staff
Factorio Staff
Posts: 5150
Joined: Sun Jan 11, 2015 2:09 pm
Contact:

Re: Mod-GUI: Changeable background

Post by Klonan »

Godmave wrote:So you can change the graphical_set, mhh. That would help at least for hard-mods. That would also explain why you can't simply change the background color of things, since the background is an image, not a filled area.
But labels don't have that I think. Will take a longer look in the evening after work.
Labels just draw text, It is not even in the GUI engine to draw any background of a label

User avatar
Godmave
Long Handed Inserter
Long Handed Inserter
Posts: 89
Joined: Tue Nov 15, 2016 3:52 pm
Contact:

Re: Mod-GUI: Changeable background

Post by Godmave »

I am just grasping at straws here. I would like to be able to have different colored areas, and set different background on hover for labels, so I can have more different font-colors too.
I tried to create my own version of the list box. Since you can kind of draw stuff on top of each other I tried that with sprites with labels on top. It works, but since you can not stretch sprites (only sprites in sprite-buttons) and I can not add new sprites with higher width in a soft-mod, I hit a road block there too.

User avatar
Klonan
Factorio Staff
Factorio Staff
Posts: 5150
Joined: Sun Jan 11, 2015 2:09 pm
Contact:

Re: Mod-GUI: Changeable background

Post by Klonan »

Godmave wrote:I am just grasping at straws here. I would like to be able to have different colored areas, and set different background on hover for labels, so I can have more different font-colors too.
I tried to create my own version of the list box. Since you can kind of draw stuff on top of each other I tried that with sprites with labels on top. It works, but since you can not stretch sprites (only sprites in sprite-buttons) and I can not add new sprites with higher width in a soft-mod, I hit a road block there too.
In 0.17 we have added LuaGuiElement::listbox

User avatar
eradicator
Smart Inserter
Smart Inserter
Posts: 5206
Joined: Tue Jul 12, 2016 9:03 am
Contact:

Re: Mod-GUI: Changeable background

Post by eradicator »

@Bilka:
Hah. I was just going to post: Hey! I have a mod that does that! But then i saw you already linked me ;)
Godmave wrote:I am just grasping at straws here. I would like to be able to have different colored areas, and set different background on hover for labels, so I can have more different font-colors too.
Labels don't have an "on hover", nor to they have a background. To imitate a listbox you can just use two custom button styles. One which defaults to black, and one which defaults to orange. Then when the player clicks a button you simple change the style on the clicked one and on the last active button. For black/grey/orange that's 3 colors = 3 pixel image.
Godmave wrote:That would also explain why you can't simply change the background color of things, since the background is an image, not a filled area.
Somewhat. The "image" that is used to fill the background contains exactly one pixel (1x1), which is tiled over the whole area.

User avatar
Godmave
Long Handed Inserter
Long Handed Inserter
Posts: 89
Joined: Tue Nov 15, 2016 3:52 pm
Contact:

Re: Mod-GUI: Changeable background

Post by Godmave »

@eredicator

oh, labels have an on-hover. I already use that. But it is only for the font-color.

what mod would that be?

btw, are you active in the factorio discord? if yes, under which name?

User avatar
eradicator
Smart Inserter
Smart Inserter
Posts: 5206
Joined: Tue Jul 12, 2016 9:03 am
Contact:

Re: Mod-GUI: Changeable background

Post by eradicator »

@godmeve
Huh, they do indeed. But using labels for clicky things feels wrong :P.
That mod is not public (yet™, someone find me an artist...).
No. I'm on irc only, same name. I prefer explaining things in public though so that other people can find them. So if you have any questions make a modding help topic or somthing.

User avatar
Godmave
Long Handed Inserter
Long Handed Inserter
Posts: 89
Joined: Tue Nov 15, 2016 3:52 pm
Contact:

Re: Mod-GUI: Changeable background

Post by Godmave »

Yeah, the only current question was for the mod :D
And I don't know how far I can adjust buttons without the need to add new stuff, which I can't in a soft-mod.
But I will look into it some more in the evening. At the moment I got a "good enough" version with labels :)

User avatar
eradicator
Smart Inserter
Smart Inserter
Posts: 5206
Joined: Tue Jul 12, 2016 9:03 am
Contact:

Re: Mod-GUI: Changeable background

Post by eradicator »

If by "soft mod" you mean that you have no access to the data-stage then it's going to be difficult, as you can't make new styles. As all of LuaStyle seems to be writable from the control stage you might still be able to get the buttons to be the right shape by recycling some of the built-in styles, but it's gonna be hacky.

User avatar
Godmave
Long Handed Inserter
Long Handed Inserter
Posts: 89
Joined: Tue Nov 15, 2016 3:52 pm
Contact:

Re: Mod-GUI: Changeable background

Post by Godmave »

Yep, no data stage available for me.

And changing stuff from inside LUA would be easier if you could somehow see which style attributes are available. Atm I always look into the definition. But some of the attributes there are not writeable. So it is a lot of trial and error.
And for the graphics I use the preview from the explorer, take the file name and search that in the lua files to get the name to use :D

Some kind of kitchensink with descriptions what is possible per thing would really save time for newbies like me.
And more vanilla tools (like the ability to set plain one-color backgrounds without sprites) to change how things look would be nice too for softmods.

0.17 might make that all a bit less important when players don't have to download mods in the right version themselves anymore.

Post Reply

Return to “Modding interface requests”