flexible sprite / borderless sprite-button & other elements

Place to ask discuss and request the modding support of Factorio. Don't request mods here.
User avatar
ownlyme
Filter Inserter
Filter Inserter
Posts: 444
Joined: Thu Dec 21, 2017 8:02 am
Contact:

flexible sprite / borderless sprite-button & other elements

Post by ownlyme »

it's quite impossible to make a gui look exactly like you imagined it.
sprite:
- cannot scale the image inside it, it always crops it
- the image cannot be replaced, like on sprite-buttons
- its quite impossible to put a label into it, like the "count" property of the sprite-buttons (you could put a label inside it, but it scales with the game's resolution, gets cropped, cannot be aligned to the bottom right corner (im trying to make a box that looks like a combinator signal))

button:
- always has borders and even padding, there should be a way to get rid of both of them.
(btw what is the style property pie_progress_color for?)

progressbar:
- there is a maximum height that it can be set to, if it's too high, the element will just take up more space but the bar won't get thicker.

choose-elem-button
- shouldn't there be a value/count property?

also changing properties of elements takes quite a lot of cpu performance, as i described in my "graph" thread. (updating the height of 350 flows takes over 1/60 secs to process.. very noticeable when you run around and look at other objects that seem to lag on every update)

sadly i cannot remember all the other problems i had with it, but i feel like im in modder's hell.
creator of 55 mods
My api requests/suggestions: ui relative for overlay||Grenade arc||Player Modifiers||textbox::selection||Singleplayer RCON||disable car's ground sounds
Rseding91
Factorio Staff
Factorio Staff
Posts: 15059
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: flexible sprite / borderless sprite-button & other elements

Post by Rseding91 »

Regarding performance: that's unlikely to change. Simply don't do that...

GUIs are meant to be created and sit static in size showing information only changing infrequently. Updating 350 sizes should only be done on initial creation.
If you want to get ahold of me I'm almost always on Discord.
User avatar
ownlyme
Filter Inserter
Filter Inserter
Posts: 444
Joined: Thu Dec 21, 2017 8:02 am
Contact:

Re: flexible sprite / borderless sprite-button & other elements

Post by ownlyme »

then put it on a different cpu core
also its not the only thing that makes the outlines of objects seem to lag when running/driving around. the game has some huge performance issues.
whatever, i didnt expect you to be motivated to work on it anyway, but please fix the other things.
creator of 55 mods
My api requests/suggestions: ui relative for overlay||Grenade arc||Player Modifiers||textbox::selection||Singleplayer RCON||disable car's ground sounds
Rseding91
Factorio Staff
Factorio Staff
Posts: 15059
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: flexible sprite / borderless sprite-button & other elements

Post by Rseding91 »

ownlyme wrote:then put it on a different cpu core
That's not how any of this works...
ownlyme wrote:also its not the only thing that makes the outlines of objects seem to lag when running/driving around. the game has some huge performance issues.
If you think you found some performance issue feel free to make a bug report about it. However, I highly suspect it's the Lua code you're using that's at fault.
ownlyme wrote: cannot scale the image inside it, it always crops it
- the image cannot be replaced, like on sprite-buttons
ownlyme wrote: its quite impossible to put a label into it, like the "count" property of the sprite-buttons (you could put a label inside it, but it scales with the game's resolution, gets cropped, cannot be aligned to the bottom right corner (im trying to make a box that looks like a combinator signal))
That's because it's a sprite not meant to ever have text in it. Every widget type is purpose created to do what it's meant to do and nothing else.
ownlyme wrote:button:
- always has borders and even padding, there should be a way to get rid of both of them.
I can't reproduce. When I set the paddings to 0 it has no paddings. Anything you're seeing is the defined font height and not padding. You can change the font height and see it change.
ownlyme wrote:choose-elem-button
- shouldn't there be a value/count property?
No, it doesn't have a value/count - it just selects the elem type. Identical to how the deconstruction planner works for selecting entity filters - again the GUI element doesn't use counts - just the thing selected. What you're talking about is an inventory GUI button widget which has to be associated with a specific inventory slot to function.
If you want to get ahold of me I'm almost always on Discord.
Rseding91
Factorio Staff
Factorio Staff
Posts: 15059
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: flexible sprite / borderless sprite-button & other elements

Post by Rseding91 »

Regarding the setting of sprite on custom-sprite - that's now fixed for 0.17.
If you want to get ahold of me I'm almost always on Discord.
User avatar
ownlyme
Filter Inserter
Filter Inserter
Posts: 444
Joined: Thu Dec 21, 2017 8:02 am
Contact:

Re: flexible sprite / borderless sprite-button & other elements

Post by ownlyme »

please see my last post in viewtopic.php?f=29&t=58752
(fonts always scale)

regarding the button (always borders and padding)
you were able to create a button that only consists of the image inside it? (and some count)
for me, buttons always look like this (at best):
button.png
button.png (1.84 KiB) Viewed 2278 times
creator of 55 mods
My api requests/suggestions: ui relative for overlay||Grenade arc||Player Modifiers||textbox::selection||Singleplayer RCON||disable car's ground sounds
User avatar
eradicator
Smart Inserter
Smart Inserter
Posts: 5211
Joined: Tue Jul 12, 2016 9:03 am
Contact:

Re: flexible sprite / borderless sprite-button & other elements

Post by eradicator »

ownlyme wrote: Wed Sep 12, 2018 6:41 am regarding the button (always borders and padding)
you were able to create a button that only consists of the image inside it? (and some count)
for me, buttons always look like this (at best):
button.png
Have you tried defining a custom button style?
A style based on a 1x1 transparent pixel (i.e. core/graphics/empty.png) with all padding set to 0 should do what you describe.
Author of: Belt Planner, Hand Crank Generator, Screenshot Maker, /sudo and more.
Mod support languages: 日本語, Deutsch, English
My code in the post above is dedicated to the public domain under CC0.
User avatar
ownlyme
Filter Inserter
Filter Inserter
Posts: 444
Joined: Thu Dec 21, 2017 8:02 am
Contact:

Re: flexible sprite / borderless sprite-button & other elements

Post by ownlyme »

okay i managed to find out how to define a button_style (and it really helps with my problem, so thank you!)

for future generations:
this is how you define a button_style:

Code: Select all

data.raw["gui-style"].default.rr_button = {
	  name = "rr_button",
      type = "button_style",
      parent = "image_tab_slot",
      scalable = false,
      width = 68,
      height = 68,
	  padding = 0,
      default_graphical_set = {
		type = "monolith",
		monolith_border = 0,
		monolith_image =
		{
			filename = "__core__/graphics/gui.png",
			priority = "extra-high-no-scale",
			width = 36,
			height = 36,
			x = 111,
			y = 0
		}
	  },  
	  
      hovered_graphical_set =  {
		type = "monolith",
		monolith_border = 0,
		monolith_image =
		{
			filename = "__core__/graphics/gui.png",
			priority = "extra-high-no-scale",
			width = 36,
			height = 36,
			x = 111,
			y = 0
		}
	  }	,
	  
      clicked_graphical_set = {
		type = "monolith",
		monolith_border = 0,
		monolith_image =
		{
			filename = "__core__/graphics/gui.png",
			priority = "extra-high-no-scale",
			width = 36,
			height = 36,
			x = 111,
			y = 0
		}
	  }
    }
Last edited by ownlyme on Wed Sep 12, 2018 3:14 pm, edited 1 time in total.
creator of 55 mods
My api requests/suggestions: ui relative for overlay||Grenade arc||Player Modifiers||textbox::selection||Singleplayer RCON||disable car's ground sounds
Post Reply

Return to “Modding interface requests”