gui

package
v0.8.2 Latest Latest
Warning

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

Go to latest
Published: Jan 31, 2021 License: GPL-3.0, GPL-3.0 Imports: 1 Imported by: 0

Documentation

Overview

Package gui is an abstraction layer for real GUI implementations. It defines the Events that can be passed from the GUI to the emulation code and also the Requests that can be made from the emulation code to the GUI. Implementations need to convert their specific signals and requests to and from these abstractions.

Index

Constants

View Source
const (
	UnsupportedGuiFeature = "unsupported gui feature: %v"
)

Sentinal error returned if GUI does no support requested feature.

Variables

This section is empty.

Functions

This section is empty.

Types

type EmulationState added in v0.7.1

type EmulationState int

EmulationState indicates to the GUI that the debugger is in a particular state.

const (
	StateInitialising EmulationState = iota
	StatePaused
	StateRunning
	StateEnding
)

List of valid emulation states.

type Event

type Event interface{}

Event represents all the different type of events that can occur in the gui

Events are the things that happen in the gui, as a result of user interaction, and sent over a registered event channel.

type EventKeyboard

type EventKeyboard struct {
	GUI  GUI
	Key  string
	Down bool
	Mod  KeyMod
}

EventKeyboard is the data that accompanies EventKeyboard events.

type EventMouseButton

type EventMouseButton struct {
	GUI    GUI
	Button MouseButton
	Down   bool
}

EventMouseButton is the data that accompanies MouseEventMove events.

type EventMouseMotion

type EventMouseMotion struct {
	GUI GUI

	// as a fraction of the window's dimensions
	X float32
	Y float32
}

EventMouseMotion is the data that accompanies MouseEventMove events.

type EventQuit

type EventQuit struct{}

EventQuit is sent when the gui window is closed.

type FeatureReq

type FeatureReq string

FeatureReq is used to request the setting of a gui attribute eg. toggling the overlay.

const (
	// ReqSetPlaymode is called whenever the playmode loop is entered.
	//
	// first argument is a pointer to the VCS, second argument is an instance
	// of received for gui events.
	ReqSetPlaymode FeatureReq = "ReqSetPlaymode" // *hardware.VCS, chan gui.Event

	// ReqSetDebugmode is called whenever the playmode loop is entered.
	//
	// first argument is a pointer to the debugger, second argument is an
	// instance of received for gui events.
	ReqSetDebugmode FeatureReq = "ReqSetDebugmode" // *debugger.Debugger, chan gui.Event

	// notify GUI of emulation state. the GUI should use this to alter how
	// infomration, particularly the display of the PixelRenderer.
	ReqState FeatureReq = "ReqState" // EmulationState

	// whether gui should use vsync or not. not all gui modes have to obey this
	// but for presentation/play modes it's a good idea to have it set.
	ReqVSync FeatureReq = "ReqVSync" // bool

	// whether the gui is visible or not. results in an error if requested in
	// playmode.
	ReqSetVisibility FeatureReq = "ReqSetVisibility" // bool

	// put gui output into full-screen mode (ie. no window border and content
	// the size of the monitor).
	ReqFullScreen FeatureReq = "ReqFullScreen" // bool

	// triggered when cartridge is being change.
	ReqChangingCartridge FeatureReq = "ReqChangingCartridge" // bool

	// special request for PlusROM cartridges.
	ReqPlusROMFirstInstallation FeatureReq = "ReqPlusROMFirstInstallation" // PlusROMFirstInstallation
)

List of valid feature requests. argument must be of the type specified or else the interface{} type conversion will fail and the application will probably crash.

Note that, like the name suggests, these are requests, they may or may not be satisfied depending other conditions in the GUI.

type FeatureReqData added in v0.7.1

type FeatureReqData interface{}

FeatureReqData represents the information associated with a FeatureReq. See commentary for the defined FeatureReq values for the underlying type.

type GUI

type GUI interface {
	// Send a request to set a GUI feature.
	SetFeature(request FeatureReq, args ...FeatureReqData) error

	// Same as SetFeature() but not waiting for the result. Useful in time
	// critical situations when you are absolutely sure there will be no
	// errors that need handling.
	SetFeatureNoError(request FeatureReq, args ...FeatureReqData)

	// Return current state of GUI feautre.
	GetFeature(request FeatureReq) (FeatureReqData, error)
}

GUI defines the operations that can be performed on visual user interfaces.

type KeyMod

type KeyMod int

KeyMod identifies.

const (
	KeyModNone KeyMod = iota
	KeyModShift
	KeyModCtrl
	KeyModAlt
)

list of valud key modifiers.

type MouseButton

type MouseButton int

MouseButton identifies the mouse button.

const (
	MouseButtonNone MouseButton = iota
	MouseButtonLeft
	MouseButtonRight
	MouseButtonMiddle
)

list of valid MouseButtonIDs.

type PlusROMFirstInstallation added in v0.7.1

type PlusROMFirstInstallation struct {
	Finish chan error
	Cart   *plusrom.PlusROM
}

PlusROMFirstInstallation is used to pass information to the GUI as part of the request.

type Stub added in v0.7.1

type Stub struct{}

func (Stub) GetFeature added in v0.7.1

func (s Stub) GetFeature(request FeatureReq) (FeatureReqData, error)

GetFeature implements the GUI interface.

func (Stub) SetFeature added in v0.7.1

func (s Stub) SetFeature(request FeatureReq, args ...FeatureReqData) error

SetFeature implements the GUI interface.

func (Stub) SetFeatureNoError added in v0.7.1

func (s Stub) SetFeatureNoError(request FeatureReq, args ...FeatureReqData)

SetFeatureNoError implements the GUI interface.

Directories

Path Synopsis
crt
Package CRT contains non-gui-specific and non-VCS-specific information.
Package CRT contains non-gui-specific and non-VCS-specific information.
shaders
Package shaders (sub-package of the CRT package) contains the GLSL shader code used by Gopher2600 to create a CRT like image.
Package shaders (sub-package of the CRT package) contains the GLSL shader code used by Gopher2600 to create a CRT like image.
Package sdlaudio provides the Audio type.
Package sdlaudio provides the Audio type.
This file is part of Gopher2600.
This file is part of Gopher2600.
lazyvalues
Package lazyvalues is the method used by sdlimgui to read emulator data from the GUI thread.
Package lazyvalues is the method used by sdlimgui to read emulator data from the GUI thread.

Jump to

Keyboard shortcuts

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