Documentation
¶
Index ¶
- Constants
- type Action
- type UI
- func (u *UI) ButtonAction(e widgets.Event, gbAction gameboy.Action) Action
- func (u *UI) EmulatorAction(action Action) Action
- func (u *UI) Hide()
- func (u *UI) Home(state uint8)
- func (u *UI) NextPalette(state uint8)
- func (u *UI) OpenROM()
- func (u *UI) PreviousPalette(state uint8)
- func (u *UI) ProcessEvents()
- func (u *UI) Quit(state uint8)
- func (u *UI) Repaint()
- func (u *UI) Screenshot(state uint8)
- func (u *UI) SetControls(keymap options.Keymap, joymap options.Joymap) (err error)
- func (u *UI) Show()
- func (u *UI) ShowDialog(dialog widgets.DialogWidget, cb widgets.DialogCloser)
- func (u *UI) StartStopRecord(state uint8)
- func (u *UI) Tick() (res gameboy.TickResult)
- func (u *UI) ToggleVoice1(state uint8)
- func (u *UI) ToggleVoice2(state uint8)
- func (u *UI) ToggleVoice3(state uint8)
- func (u *UI) ToggleVoice4(state uint8)
Constants ¶
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(state uint8)
Action type for user interactions. TODO: see if we can use a single one for gameboy/ui. TODO: see if we can't move that to widgets (see QAction for inspiration)
type UI ¶
type UI struct {
Emulator *gameboy.GameBoy
KeyboardControls map[options.KeyStroke]Action
GameControllerControls map[sdl.GameControllerButton]Action
SigINTChan chan os.Signal
// 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. TODO: move Gameboy inside UI, implement UI.Tick(), see if it works.
func (*UI) ButtonAction ¶
ButtonAction returns a control action function that will propagate event keys for button presses to the proper object (emulator if it's running, UI if it's paused).
func (*UI) EmulatorAction ¶
EmulatorAction returns a control action function that will handle some high-level events but only if the emulator is currently running (so that we don't change palettes or stuff while the emulator is paused).
func (*UI) NextPalette ¶
NextPalette switches colors to the next defined palette, wrapping around. There should always be at least a default palette defined.
func (*UI) PreviousPalette ¶
PreviousPalette switches colors to the previous defined palette, wrapping around. There should always be at least a default palette defined.
func (*UI) ProcessEvents ¶
func (u *UI) ProcessEvents()
func (*UI) Screenshot ¶
Screenshot saves the current frame to disk as a PNG file. TODO: configurable folder, obviously.
func (*UI) SetControls ¶
SetControls validates and sets the given control map for the emulator's UI.
func (*UI) ShowDialog ¶
func (u *UI) ShowDialog(dialog widgets.DialogWidget, cb widgets.DialogCloser)
TODO: ... another dialogs.go, I guess.
func (*UI) StartStopRecord ¶
StartStopRecord starts recording video output to GIF and closes the file when done. Defined as a single action to toggle between the two and avoid opening several GIFs at once. TODO: move to ui
func (*UI) ToggleVoice1 ¶
ToggleVoice1 mutes or unmutes the first audio generator (Square 1).
func (*UI) ToggleVoice2 ¶
ToggleVoice2 mutes or unmutes the second audio generator (Square 2).
func (*UI) ToggleVoice3 ¶
ToggleVoice3 mutes or unmutes the third audio generator (Wave).
func (*UI) ToggleVoice4 ¶
ToggleVoice4 mutes or unmutes the fourth audio generator (Noise).