ui

package
v0.0.0-...-657eaca Latest Latest
Warning

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

Go to latest
Published: Oct 4, 2023 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Margin is the space in pixels between screen border and UI text.
	Margin = 2
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Action

type Action func(eventType uint32)

Action type for user interactions. TODO: see if we can use a single one for gameboy/ui.

type UI

type UI struct {
	Enabled bool

	Controls map[options.KeyStroke]Action

	// Send true to this channel to quit the program.
	QuitChan chan bool
	// contains filtered or unexported fields
}

UI structure to manage user commands and overlay.

func New

func New(config *options.Options) *UI

Return a UI instance given a renderer to create the overlay texture.

func (*UI) Hide

func (u *UI) Hide()

func (*UI) Home

func (u *UI) Home(eventType uint32)

Home hides the UI and resumes emulation.

func (*UI) Message

func (u *UI) Message(text string, seconds time.Duration)

Message shows a temporary message that will be cleared after the given duration (in seconds). This message stacks with permanent text set with Text().

func (*UI) ProcessEvents

func (u *UI) ProcessEvents()

func (*UI) Quit

func (u *UI) Quit(eventType uint32)

Quit cleanly quits the program.

func (*UI) Repaint

func (u *UI) Repaint()

func (*UI) ScreenBuffer

func (u *UI) ScreenBuffer() (buffer []byte)

ScreenBuffer creates a new SDL texture suitable to use for the emulator's screen, and a pixel buffer that it returns, which the PPU should write into. This lets us do funny stuff with the GameBoy display's pixels in the UI that we couldn't easily do if we only had access to a texture.

func (*UI) SetControls

func (u *UI) SetControls(keymap options.Keymap) (err error)

SetControls validates and sets the given control map for the emulator's UI.

func (*UI) Show

func (u *UI) Show()

func (*UI) Text

func (u *UI) Text(text string)

Set permanent text (useful for persistent UI). Call with empty string to clear.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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