transfer

package
v1.0.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 23, 2024 License: GPL-3.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Color

type Color struct {
	Red   float64 `json:"r"`
	Green float64 `json:"g"`
	Blue  float64 `json:"b"`
	Alpha float64 `json:"a"`
}

func (*Color) UnmarshalJSON

func (c *Color) UnmarshalJSON(data []byte) error

type FactorioIcon

type FactorioIcon struct {
	Icon        string     `json:"icon"`
	Icons       []IconData `json:"icons"`
	IconSize    int16      `json:"icon_size"`
	IconMipmaps uint8      `json:"icon_mipmaps"`
}

type IconData

type IconData struct {
	Icon        string   `json:"icon"`
	IconSize    int16    `json:"icon_size"`
	Tint        *Color   `json:"tint"`
	Shift       *Vector  `json:"shift"`
	Scale       *float64 `json:"scale"`
	IconMipmaps uint8    `json:"icon_mipmaps"`
}

type Layer

type Layer struct {
	FileName string
	Offset   Vector
	Scale    float64
	Size     int
	Tint     Color
}

type RenderIcon

type RenderIcon struct {
	Layers        []Layer
	OutputSize    int
	RenderedSize  int
	RenderedScale float64
}

func NewRenderIcon

func NewRenderIcon(factorioIcon FactorioIcon, scaleBase ScaleBase, sizeToRender int) RenderIcon

NewRenderIcon transforms the provided Factorio icon into the structure required by the actual renderer, adjusting the sizes etc. of the layers to match what Factorio would actually render. The scaleBase is the size of the icon on which the scale values are based. If an item or recipe icon is rendered, the scaleBase must be 32. For all other types of icons, 0 must be passed so that scaling is based on the first layer. The sizeToRender is the size the final image should have. The renderer will scale the rendered icon accordingly.

type ScaleBase added in v1.0.2

type ScaleBase uint
const (
	// ScaleBaseDefault is the scale base used for most of the icons. The first layer of the icon will set the scale.
	ScaleBaseDefault ScaleBase = 0
	// ScaleBaseItemOrRecipe is the scale base used for item and recipe icons. The scale is always based on 32px.
	ScaleBaseItemOrRecipe ScaleBase = 32
)

type Vector

type Vector struct {
	X float64
	Y float64
}

func (*Vector) UnmarshalJSON

func (v *Vector) UnmarshalJSON(data []byte) error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL