Page 1 of 1

flexible sprite / borderless sprite-button & other elements

Posted: Wed Aug 08, 2018 4:17 am
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.

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

Posted: Thu Aug 09, 2018 8:53 pm
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.

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

Posted: Sat Aug 11, 2018 6:39 am
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.

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

Posted: Sat Aug 11, 2018 6:56 am
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.

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

Posted: Sat Aug 11, 2018 7:03 am
by Rseding91
Regarding the setting of sprite on custom-sprite - that's now fixed for 0.17.

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

Posted: Wed Sep 12, 2018 6:41 am
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 2282 times

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

Posted: Wed Sep 12, 2018 9:05 am
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.

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

Posted: Wed Sep 12, 2018 10:27 am
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
		}
	  }
    }