types

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 24, 2026 License: MPL-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AnimatedBoard added in v0.0.3

type AnimatedBoard[T any] interface {
	Board[T]
	Render(dimensions BoardDimensions) Animation
}

AnimatedBoard is an interface for a board which displays a pre-rendered animated image. If a board needs to update while it's being shown, then it should implement DynamicBoard instead.

type Animation added in v0.0.3

type Animation = []AnimationFrame

Animation is an array of AnimationFrame that can be played on a board

type AnimationFrame added in v0.0.3

type AnimationFrame struct {
	Img      image.Image
	Duration time.Duration
}

AnimationFrame is a struct that describes a single frame (image) of an animation and the duration it should be displayed for.

type Board

type Board[T any] interface {
	GetId() string
	GetName() string
	GetSupportedDimensions() []BoardDimensions
	GetType() BoardType
	// GetDatasourceType returns the type identifier of the datasource this board requires.
	// Type identifiers follow the convention "author/plugin-name/type-name",
	// e.g. "benwiebe/nhl-plugin/game-data".
	GetDatasourceType() string
	Init(config json.RawMessage, datasource Datasource[T]) error
}

Board is an interface for all boards' common methods. Board and its related interfaces are used to describe the different types of boards that are provided by a plugin and which can be displayed on the screen.

type BoardDimensions

type BoardDimensions struct {
	Width  int
	Height int
}

BoardDimensions is a struct to describe the dimensions of a board

type BoardType added in v0.0.3

type BoardType string

BoardType is a string to describe the type of a board to ensure that the correct type cast is used when creating a board. The supported types are: static, animated and dynamic

const (
	BoardTypeStatic   BoardType = "static"
	BoardTypeAnimated BoardType = "animated"
	BoardTypeDynamic  BoardType = "dynamic"
)

type Datasource

type Datasource[T any] interface {
	GetId() string
	GetName() string
	// GetType returns the type identifier for the data this datasource provides.
	// Type identifiers follow the convention "author/plugin-name/type-name",
	// e.g. "benwiebe/nhl-plugin/game-data". A board's GetDatasourceType() must
	// match the datasource's GetType() for them to be compatible.
	GetType() string
	GetData() T
}

Datasource is an interface for a datasource that will be provided by a plugin.

type DynamicBoard added in v0.0.3

type DynamicBoard[T any] interface {
	Board[T]
	Render(dimensions BoardDimensions) AnimationFrame
}

DynamicBoard is an interface for a board which displays content that may change while the board is being shown. If the board does not need to update while it's being shown, then it should implement AnimatedBoard instead.

type PluginConfig

type PluginConfig = json.RawMessage

type PluginType

type PluginType string
const (
	PluginTypeDatasource PluginType = "datasource"
	PluginTypeBoards     PluginType = "boards"
	PluginTypeCombined   PluginType = "combined"
)

type StaticBoard added in v0.0.3

type StaticBoard[T any] interface {
	Board[T]
	Render(dimensions BoardDimensions) image.Image
}

StaticBoard is an interface for a board which displays a static image

Jump to

Keyboard shortcuts

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