gui

package
v0.4.2 Latest Latest
Warning

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

Go to latest
Published: Aug 24, 2025 License: GPL-3.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Action

type Action int
const (
	Nothing Action = iota
	StickLeft
	StickUp
	StickRight
	StickDown
	StickButtonA
	StickButtonB
	Select
	Start
	Pause
	P0Pro
	P1Pro
)

type AudioReader

type AudioReader interface {
	io.Reader
	Nudge()
}

type AudioSetup

type AudioSetup struct {
	Freq float64
	Read AudioReader
}

type GUI

type GUI struct {
	SetImage  chan Image
	UserInput chan Input

	// implementations of UI should default to StateRunning
	State chan State

	// AudioSetup should be nil if the emulation is to have no audio
	AudioSetup chan AudioSetup

	// optional function called by GUI during it's update loop
	UpdateGUI func() error
}

func NewGUI

func NewGUI() *GUI

NewGUI creates a new GUI instance. It does not initialise the RegisterAudio channel. For that, use the WithAudio() function

type Image

type Image struct {
	Main    *image.RGBA
	Overlay *image.RGBA
	Prev    *image.RGBA

	// the ID of the image
	ID string

	// the x/y coordinates of the next pixel to be drawn to Main
	Cursor [2]int
}

type Input

type Input struct {
	Action Action
	Set    bool
}

type State

type State int

the state of the emulation

const (
	StateRunning State = iota
	StatePaused
)

the emulation state can be either paused or running

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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