Types/IconData: Difference between revisions

From Official Factorio Wiki
Jump to navigation Jump to search
(Added some precisions about scale, shift and shadow, based on my tests.)
Line 31: Line 31:
'''Type''': [[Types/double]]
'''Type''': [[Types/double]]


'''Default''': 1
'''Default for items/recipes''': (32/icon_size)


Values different than 1 specify the scale of the icon on default gui scale.
'''Default for technologies''': (256/icon_size)
 
When set, specifies the scale of the icon on the GUI scale.
Scale 2 means that the icon will be 2 times bigger on screen (and more pixelated).
Scale 2 means that the icon will be 2 times bigger on screen (and more pixelated).


Line 40: Line 42:


'''Default''': 0
'''Default''': 0
== Notes ==
• Only the first icon layer will display a shadow.
• The final combination of icons will always be resized in GUI based on the first icon layer's size, but won't be resized when displayed on machines in alt-mode.
• Shift values are based on final size (icon_size * scale) of the first icon.


== Examples ==
== Examples ==
Line 45: Line 55:
<syntaxhighlight lang="lua">{
<syntaxhighlight lang="lua">{
   icon = "__base__/graphics/icons/fluid/heavy-oil.png",
   icon = "__base__/graphics/icons/fluid/heavy-oil.png",
   icon_size = 32,
   icon_size = 64,
   scale = 0.5,
   scale = 0.5,
   shift = {4, -8}
   shift = {4, -8}
}</syntaxhighlight>
}</syntaxhighlight>

Revision as of 22:11, 7 August 2021

Basics

Data of one icon "layer" for the icons property of the Types/IconSpecification.

Mandatory properties

icon

Type: Types/FileName

The path to the icon.

icon_size

Type: Types/SpriteSizeType

Mandatory if icon_size is not specified outside of icons. The size of the square icon, in pixels, e.g. 32 for a 32px by 32px icon.

Optional properties

tint

Type: Types/Color

Default: {r=1, g=1, b=1, a=1}

Tint of the icon. Default is when tint = nil. See Type for full details.

shift

Type: Types/vector

Default: {0, 0}

Used to offset the icon "layer" from the overall icon.

scale

Type: Types/double

Default for items/recipes: (32/icon_size)

Default for technologies: (256/icon_size)

When set, specifies the scale of the icon on the GUI scale. Scale 2 means that the icon will be 2 times bigger on screen (and more pixelated).

icon_mipmaps

Type: Types/uint8

Default: 0

Notes

• Only the first icon layer will display a shadow.

• The final combination of icons will always be resized in GUI based on the first icon layer's size, but won't be resized when displayed on machines in alt-mode.

• Shift values are based on final size (icon_size * scale) of the first icon.

Examples

{
  icon = "__base__/graphics/icons/fluid/heavy-oil.png",
  icon_size = 64,
  scale = 0.5,
  shift = {4, -8}
}