api

package module
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: 4 Imported by: 8

README

QuestScreen Plugin API

This is the plugin API for QuestScreen. For documentation, please see the QuestScreen website.

License

The plugin API, unlike the QuestScreen main app, is released under the terms of the MIT license.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Background

type Background struct {
	Primary      RGBA `json:"primary"`
	Secondary    RGBA `json:"secondary"`
	TextureIndex int  `json:"textureIndex"`
}

Background describes how the background of a rectangle should be colored. It defines a primary and secondary color and optionally the index of a texture that should be used to merge the colors.

If not texture is specified, the background is drawn using only the Primary color.

type Font

type Font struct {
	FamilyIndex int       `json:"familyIndex"`
	Size        FontSize  `json:"size"`
	Style       FontStyle `json:"style"`
	Color       RGBA      `json:"color"`
}

Font describes the font used for drawing text.

type FontSize

type FontSize int

FontSize describes the size of a font. Font sizes are relative to the screen size.

const (
	// SmallFont is the smallest size available
	SmallFont FontSize = iota
	// ContentFont is the size used for content text by default.
	ContentFont
	// MediumFont is a size between Content and Heading.
	MediumFont
	// HeadingFont is the size used for heading text by default.
	HeadingFont
	// LargeFont is a size larger than Heading.
	LargeFont
	// HugeFont is the largest font; usually used for displaying a single word
	// on the screen.
	HugeFont
	// NumFontSizes is not a valid Size, but used for iterating
	NumFontSizes
)

func (FontSize) MarshalYAML

func (fs FontSize) MarshalYAML() (interface{}, error)

MarshalYAML maps the given font size to a string

func (*FontSize) UnmarshalYAML

func (fs *FontSize) UnmarshalYAML(value *yaml.Node) error

UnmarshalYAML sets the font size from a YAML scalar

type FontStyle

type FontStyle int

FontStyle describes possible styles of a font

const (
	// RegularFont is the default font style
	RegularFont FontStyle = iota
	// BoldFont is the bold font style
	BoldFont
	// ItalicFont is the italic font style
	ItalicFont
	// BoldItalicFont is the bold and italic font style
	BoldItalicFont
	// NumFontStyles is not a valid Style, but used for iterating.
	NumFontStyles
)

func (FontStyle) MarshalYAML

func (fs FontStyle) MarshalYAML() (interface{}, error)

MarshalYAML maps the given font style to a string

func (*FontStyle) UnmarshalYAML

func (fs *FontStyle) UnmarshalYAML(value *yaml.Node) error

UnmarshalYAML sets the font style from a YAML scalar

type RGB

type RGB struct {
	R uint8 `yaml:"r"`
	G uint8 `yaml:"g"`
	B uint8 `yaml:"b"`
}

RGB represents a color in RGB color space.

func (RGB) AsBackground

func (c RGB) AsBackground() Background

AsBackground returns a Background with c as background color and no texture.

func (*RGB) FromHexRepr

func (c *RGB) FromHexRepr(repr string) error

FromHexRepr loads a representation with leading '#' and two hex digits per color into the given object.

func (RGB) HexRepr

func (c RGB) HexRepr() string

HexRepr returns the color rendered with leading '#' and two hex digits per color.

func (*RGB) MarshalJSON

func (c *RGB) MarshalJSON() ([]byte, error)

MarshalJSON represents the color as JSON string containing a HTML hexcode

func (*RGB) UnmarshalJSON

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

UnmarshalJSON loads a JSON string as HTML hexcode into RGBColor

func (RGB) WithAlpha

func (c RGB) WithAlpha(alpha uint8) RGBA

WithAlpha generates an RGBAColor with the given alpha value.

type RGBA

type RGBA struct {
	R uint8 `yaml:"r"`
	G uint8 `yaml:"g"`
	B uint8 `yaml:"b"`
	A uint8 `yaml:"a"`
}

RGBA represents a color in RGB color space with alpha channel

func (RGBA) AsBackground

func (c RGBA) AsBackground() Background

AsBackground returns a Background with c as background color and no texture.

func (*RGBA) FromHexRepr

func (c *RGBA) FromHexRepr(repr string) error

FromHexRepr loads a representation with leading '#' and two hex digits per color into the given object.

func (RGBA) HexRepr

func (c RGBA) HexRepr() string

HexRepr returns the color rendered with leading '#' and two hex digits per color.

func (*RGBA) MarshalJSON

func (c *RGBA) MarshalJSON() ([]byte, error)

MarshalJSON represents the color as JSON string containing a HTML hexcode

func (*RGBA) UnmarshalJSON

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

UnmarshalJSON loads a JSON string as HTML hexcode into RGBAColor

func (RGBA) WithoutAlpha

func (c RGBA) WithoutAlpha() RGB

WithoutAlpha returns the color without the Alpha component

Directories

Path Synopsis
web

Jump to

Keyboard shortcuts

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