display

package
v0.0.0-...-77df42f Latest Latest
Warning

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

Go to latest
Published: Mar 14, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var InstalledDrivers []*InstalledDriver

InstalledDrivers is a list of all the installed drivers. This variable is exported so that it can be used by the main program to determine which drivers can be used. Drivers should call display.Install in their init() function.

Functions

func Init

func Init()

Init initializes the display drivers and ensures at least one has been installed.

func Install

func Install(name string, driver Driver, options []DriverOption)

Install registers a display driver with the given name.

func RegisterFlags

func RegisterFlags()

RegisterFlags iterates through all the display driver options and registers them with the flag package.

Types

type Driver

type Driver interface {
	// Initialize initializes the display driver by attaching it to
	// the emulator that is using it.
	Initialize(emu Emulator)
	// Start the display driver.
	Start(fb <-chan []byte, events <-chan event.Event, pressed, released chan<- io.Button) error
	// Stop the display driver.
	Stop() error
}

Driver is the interface that wraps the basic methods for a display driver.

func GetDriver

func GetDriver(name string) Driver

GetDriver returns the driver with the given name, or nil if no driver with that name is installed.

type DriverOption

type DriverOption struct {
	Name        string // name of the option
	Default     any    // default value of the option
	Value       any    // pointer to the value of the option
	Description string // description of the option
	Type        string // "int", "bool", "string", "float"
}

DriverOption is a display driver option. This is used to configure a display driver.

type Emulator

type Emulator interface {
	// SendCommand sends a command packet to the emulator.
	SendCommand(command emulator.CommandPacket) emulator.ResponsePacket
	// State returns the state of the emulator.
	State() emulator.State
}

Emulator is the interface that wraps the basic methods for an emulator to implement in order for the driver to be able to interact with it. This is used to allow the driver to control the emulator. The emulator is passed to the driver during initialization.

type InstalledDriver

type InstalledDriver struct {
	Name    string
	Options []DriverOption
	Driver
}

InstalledDriver is a driver that has been installed. This is used to allow drivers to register their name.

Directories

Path Synopsis
Package event defines the various event types that can be sent to a display.Driver.
Package event defines the various event types that can be sent to a display.Driver.

Jump to

Keyboard shortcuts

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