gui

package
v0.3.3 Latest Latest
Warning

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

Go to latest
Published: Aug 3, 2020 License: GPL-3.0, GPL-3.0 Imports: 0 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

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

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 EventDbgMouseButton

type EventDbgMouseButton struct {
	Button   MouseButton
	Down     bool
	X        int
	Y        int
	HorizPos int
	Scanline int
}

EventDbgMouseButton is the data that accompanies MouseEventMove events

type EventKeyboard

type EventKeyboard struct {
	Key  string
	Down bool
	Mod  KeyMod
}

EventKeyboard is the data that accompanies EventKeyboard events

type EventMouseButton

type EventMouseButton struct {
	Button MouseButton
	Down   bool
}

EventMouseButton is the data that accompanies MouseEventMove events

type EventMouseMotion

type EventMouseMotion struct {
	// 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 (
	// visibility can be interpreted by the gui implementation in different
	// ways. at it's simplest it should set the visibility of the TV screen
	ReqSetVisibility    FeatureReq = "ReqSetVisibility"    // bool
	ReqToggleVisibility FeatureReq = "ReqToggleVisibility" // none

	// the following requests should set or toggle visual elements of the
	// debugger
	ReqSetDbgColors    FeatureReq = "ReqSetDbgColors"    // bool
	ReqToggleDbgColors FeatureReq = "ReqToggleDbgColors" // none
	ReqSetCropping     FeatureReq = "ReqSetCropping"     // bool
	ReqToggleCropping  FeatureReq = "ReqToggleCropping"  // none
	ReqSetOverlay      FeatureReq = "ReqSetOverlay"      // bool
	ReqToggleOverlay   FeatureReq = "ReqToggleOverlay"   // none
	ReqCRTeffects      FeatureReq = "ReqCRTeffects"      // bool
	ReqSetScale        FeatureReq = "ReqSetScale"        // float
	ReqIncScale        FeatureReq = "ReqIncScale"        // none
	ReqDecScale        FeatureReq = "ReqDecScale"        // none

	// pause is set when the debugger has paused it's loop. the gui can then
	// present information differently as necessary
	ReqSetPause FeatureReq = "ReqSetPause" // bool

	// The add debugger request must be made by the debugger if debug access to
	// the the machine is required by the GUI
	ReqAddDebugger FeatureReq = "ReqAddDebugger" // *debugger.Debugger

	// the event channel is used to by the GUI implementation to send
	// information back to the main program. the GUI may or may not be in its
	// own go routine but regardless, the event channel is used for this
	// purpose.
	ReqSetEventChan FeatureReq = "ReqSetEventChan" // chan gui.Event()

	// playmode is called whenever the play/debugger looper is changed. like
	// all other requests this may not do anything, depending on the GUI
	// specifics
	ReqSetPlaymode FeatureReq = "ReqSetPlaymode" // bool

	// trigger a save preferences event. usually performed before gui is
	// destroyed or before some other destructive action
	ReqSavePrefs FeatureReq = "ReqSavePrefs" // none

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

	// ------------------------------------------------------
	// the following requests are deprecated
	ReqSetVisibleOnStable FeatureReq = "ReqSetVisibleOnStable" // none
)

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 satisifed depending other conditions in the GUI.

type GUI

type GUI interface {
	// send a request to set a gui feature
	ReqFeature(request FeatureReq, args ...interface{}) 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

Directories

Path Synopsis
deprecated
sdldebug
Package sdldebug implements the GUI interface.
Package sdldebug implements the GUI interface.
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 (and possibly other GUI implementations) when access emulator data from the GUI thread.
Package lazyvalues is the method used by sdlimgui (and possibly other GUI implementations) when access emulator data from the GUI thread.

Jump to

Keyboard shortcuts

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