Gopher2600/gui/gui.go
JetSetIlly d32262adff simplified how gui implements and handles notifications
debugger no longer sends play, pause notifications to the gui. the gui
polls for that information as required

govern package now has SubState type to complement the State type.
StateIntegrity() function enforces combinations of State and SubState,
called from debugger.setState() function

playmode notifications reworked and contained in a single playmode_overlay.go
file. this includes the FPS and screen detail

preference value sdlimgui.playmode.fpsOverlay replaced with
sdlimgui.playmode.fpsDetail. still toggled with F7 key

coproc icon moved to top-left corner of playmode overlay and only
visible when FPS detail is showing

when FPS detail is showing multiple (small) icons care shown. when it is
not showing, a single (large) icon is shown according to the priority of
the icon. eg. pause indicator has higher priority than the mute
indicator
2024-04-12 18:20:29 +01:00

74 lines
3 KiB
Go

// This file is part of Gopher2600.
//
// Gopher2600 is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Gopher2600 is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Gopher2600. If not, see <https://www.gnu.org/licenses/>.
package gui
// GUI defines the operations that can be performed on visual user interfaces.
type GUI interface {
// Send a request to set a GUI feature. Returns an error so that it can be
// shown in the appropriate context (terminal or the log depending on what
// was being requested)
SetFeature(request FeatureReq, args ...FeatureReqData) error
}
// FeatureReq is used to request the setting of a gui attribute eg. toggling the overlay.
type FeatureReq string
// FeatureReqData represents the information associated with a FeatureReq. See
// commentary for the defined FeatureReq values for the underlying type.
type FeatureReqData interface{}
// 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.
const (
// notify gui of the underlying emulation mode.
ReqSetEmulationMode FeatureReq = "ReqSetEmulationMode" // govern.Mode
// program is ending. gui should do anything required before final exit.
ReqEnd FeatureReq = "ReqEnd" // nil
// put gui output into full-screen mode (ie. no window border and content
// the size of the monitor).
ReqFullScreen FeatureReq = "ReqFullScreen" // bool
// an event generated by the cartridge has occured. for example, network
// activity from a PlusROM cartridge.
ReqNotification FeatureReq = "ReqNotification" // notifications.Notify
// peripheral has been changed for one of the ports.
ReqPeripheralPlugged FeatureReq = "ReqPeripheralPlugging" // plugging.PortID, plugging.PeripheralID
// open ROM selector.
ReqROMSelector FeatureReq = "ReqROMSelector" // nil
// request for a comparison window to be opened.
ReqComparison FeatureReq = "ReqComparison" // chan *image.RGBA, chan *image.RGBA
// request for bot features to be enabled. a nil argument will cause the
// bot features to be removed.
ReqBotFeedback FeatureReq = "ReqBotFeedback" // *bots.Feedback
// request for the coprocess source window to open at the specified line
ReqCoProcSourceLine FeatureReq = "ReqCoProcSourceLine" // *developer.SourceLine
// request a screenshot to be taken
// optional argument is the filename for the screenshot
ReqScreenshot FeatureReq = "ReqScreenshot" // [optional] filename
)