config

package
v0.3.1-0...-ca91996 Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2021 License: MIT Imports: 6 Imported by: 5

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BackgroundSelect

type BackgroundSelect struct {
	api.Background
}

BackgroundSelect is an Item that allows the user to define a background by setting a primary color and optionally, a secondary color together with a texture.

func NewBackgroundSelect

func NewBackgroundSelect(value api.Background) *BackgroundSelect

NewBackgroundSelect creates a new BackgroundSelect having the given primary color and no texture. This can be used for the default config of a module, since it requires *Background (and RGBA.AsBackground does provide Background).

func (*BackgroundSelect) Load

func (b *BackgroundSelect) Load(
	input *yaml.Node, ctx server.Context) error

Load loads a background from a YAML input `{primary: <rgb>, secondary: <rgb>, texture: <name>}`

func (*BackgroundSelect) Persist

func (b *BackgroundSelect) Persist(ctx server.Context) interface{}

Persist returns a view that gives the texture name as string.

func (*BackgroundSelect) Receive

func (b *BackgroundSelect) Receive(
	input json.RawMessage, ctx server.Context) error

Receive loads a background from a json input `{"primary": <rgb>, "secondary": <rgb>, "textureIndex": <number>}`

func (*BackgroundSelect) Send

func (b *BackgroundSelect) Send(ctx server.Context) interface{}

Send returns the object itself.

type FontSelect

type FontSelect struct {
	api.Font
}

FontSelect is an Item that allows the user to select a font family, size, style and color.

func NewFontSelect

func NewFontSelect(familyIndex int, size api.FontSize, style api.FontStyle,
	color api.RGBA) *FontSelect

NewFontSelect creates a new FontSelect item with the given values

func (*FontSelect) Load

func (f *FontSelect) Load(
	input *yaml.Node, ctx server.Context) error

Load loads a selectable font from a YAML input `{family: <string>, size: <number>, style: <number>}`

func (*FontSelect) Persist

func (f *FontSelect) Persist(ctx server.Context) interface{}

Persist returns a view that gives the family name as string.

func (*FontSelect) Receive

func (f *FontSelect) Receive(
	input json.RawMessage, ctx server.Context) error

Receive loads a font from a json input `{"familyIndex": <number>, "size": <number>, "style": <number>}`

func (*FontSelect) Send

func (f *FontSelect) Send(ctx server.Context) interface{}

Send returns the object itself.

type Item

Item describes an item in a module's configuration. A Item's public fields will be loaded from YAML structure automatically via reflection, and JSON serialization will also be done via reflection. you may use the tags `json:` and `yaml:` on those fields as documented in the json and yaml.v3 packages.

Jump to

Keyboard shortcuts

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