gui

package
v0.7.4 Latest Latest
Warning

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

Go to latest
Published: Jan 9, 2026 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

	Select // bool
	Start  // bool
	Pause  // bool
	P0Pro  // bool
	P1Pro  // bool

	StickLeft    // bool
	StickUp      // bool
	StickRight   // bool
	StickDown    // bool
	StickButtonA // bool
	StickButtonB // bool

	AnalogueSelect // bool

	PaddleFire // PaddleFireData
	PaddleMove // PaddleMoveData

	TrakballFire // bool
	TrakballMove // TrakballMove
)

type AudioReader

type AudioReader interface {
	io.Reader
	Nudge()
}

type AudioSetup

type AudioSetup struct {
	Freq int
	Read AudioReader
}

type Blob added in v0.7.1

type Blob struct {
	Filename string
	Data     []uint8
}

type Command added in v0.7.0

type Command []string

type GUI

type GUI struct {
	SetImage  chan Image
	UserInput chan Input
	Commands  chan Command
	Blob      chan Blob

	// 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

	// gui receives a string (last selected file) and returns result over the same channel
	FileRequest   chan string
	RequestedFile chan string

	// display an error message
	ErrorDialog chan string

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

func NewGUI

func NewGUI() *GUI

NewGUI creates a new GUI instance

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 {
	Port   Port
	Action Action
	Data   any
}

type PaddleFireData added in v0.7.3

type PaddleFireData struct {
	Paddle int // 0 or 1 to indicate which paddle in the pair
	Fire   bool
}

type PaddleMoveData added in v0.7.3

type PaddleMoveData struct {
	Paddle int // 0 or 1 to indicate which paddle in the pair
	Delta  int // distance moved by paddle device
}

type Port added in v0.7.3

type Port int
const (
	Player0 Port = iota
	Player1
	Panel
)
const Undefined Port = -1

type State

type State int

the state of the emulation

const (
	StateRunning State = iota
	StatePaused
)

the emulation state can be either paused or running

type TrakballMoveData added in v0.7.3

type TrakballMoveData struct {
	DeltaX int
	DeltaY int
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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