Unify button and checkbox graphic set properties

Place to ask discuss and request the modding support of Factorio. Don't request mods here.
Post Reply
JasonC
Filter Inserter
Filter Inserter
Posts: 448
Joined: Tue Mar 22, 2016 3:05 am
Contact:

Unify button and checkbox graphic set properties

Post by JasonC »

Currently, for checkbox_styles, graphics are specified as:

Code: Select all

<style> = {
  default_background = Sprite,
  hovered_background = Sprite,
  clicked_background = Sprite,
  disabled_background = Sprite
}
And button_styles are specified as:

Code: Select all

<style> = {
  default_graphical_set = GraphicalSet,
  hovered_graphical_set = GraphicalSet,
  clicked_graphical_set = GraphicalSet,
  disabled_graphical_set = GraphicalSet
}
Where, as far as I can tell (I don't think these are documented), "Sprite" is your standard, run-of-the-mill icon:

Code: Select all

Sprite {
  filename = ...,
  width = ...,
  height = ...,
  x = ...,
  y = ...,
  priority = ...,
  shift = ...,
  tint = ...,
  etc.
}
And "GraphicalSet" is a more complex type that allows monoliths, compositions, animations, etc., e.g. for a monolith:

Code: Select all

MonolithGraphicalSet = {
  type = "monolith",
  monolith_image = Sprite,
  etc.
The Graphical-Set based elements are far more powerful, in particular "composition" is extremely useful for buttons.

I'd like to see this interface unified. In particular, I would like the following specific changes:
  • Give checkbox_styles a full complement of *_graphical_set keys and capabilities.
  • For compatibility, you may want to retain *_background as well, where it behaves as a monolith and takes precedence over *_graphical_set if present, at least for a few versions. Unless you don't care, then whatever.
This goes hand in hand with this other feature request to add a graphical set image type for layered images, and would endow checkboxes and other GUI elements with that power as well, if both were implemented.

Unifying (and documenting, officially) the interface could potentially simplify style code and could certainly cause less confusion. Also adding support for graphical sets to checkboxes gives them a lot of extra power, specifically support for "composition" lets you make check graphics independent of element size, and also share the same border graphics with your buttons, potentially reducing the number (and specificity) of graphics you may have to create for custom GUIs.

Note, however, though, that one of the major motivations for this request is to compensate for a few shortcomings elsewhere, in particular limitations to the current capabilities of buttons for displaying images that necessitate using checkboxes instead, which are too complex to list as a rationale here.

This request applies to any other GUI elements (not entity/item/etc prototype icons, those are sufficiently simple as-is) that are also currently using Sprites instead of GraphicalSets.

PS: As a bonus, give label_styles a background_graphical_set!
Took a break from 0.12.29 to 0.17.79, and then to ... oh god now it's 1.something. I never know what's happening.

Post Reply

Return to “Modding interface requests”