Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( Pause = emulator.CommandPacket{Command: emulator.CommandPause} Resume = emulator.CommandPacket{Command: emulator.CommandResume} Reset = emulator.CommandPacket{Command: emulator.CommandReset} Close = emulator.CommandPacket{Command: emulator.CommandClose} )
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.
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.