openMSX
Classes | Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
openmsx::VisibleSurface Class Referencefinal

An OutputSurface which is visible to the user, such as a window or a full screen display. More...

#include <VisibleSurface.hh>

Inheritance diagram for openmsx::VisibleSurface:
Inheritance graph
[legend]
Collaboration diagram for openmsx::VisibleSurface:
Collaboration graph
[legend]

Public Member Functions

 VisibleSurface (Display &display, RTScheduler &rtScheduler, EventDistributor &eventDistributor, InputEventGenerator &inputEventGenerator, CliComm &cliComm, VideoSystem &videoSystem)
 
 ~VisibleSurface () override
 
CliCommgetCliComm () const
 
DisplaygetDisplay () const
 
void updateWindowTitle ()
 
bool setFullScreen (bool fullscreen)
 
void resize ()
 
void finish ()
 When a complete frame is finished, call this method.
 
std::unique_ptr< LayercreateSnowLayer ()
 
std::unique_ptr< LayercreateOSDGUILayer (OSDGUI &gui)
 
std::unique_ptr< LayercreateImGUILayer (ImGuiManager &manager)
 
std::unique_ptr< OutputSurfacecreateOffScreenSurface ()
 Create an off-screen OutputSurface which has similar properties as this VisibleSurface.
 
void fullScreenUpdated (bool fullScreen)
 
std::optional< gl::ivec2getWindowPosition () const
 Returns x,y coordinates of top-left window corner, or returns a nullopt when in fullscreen mode.
 
void setWindowPosition (gl::ivec2 pos)
 
void saveScreenshot (const std::string &filename) override
 Save the content of this OutputSurface to a PNG file.
 
void update (const Setting &setting) noexcept override
 
int signalEvent (const Event &event) override
 This method gets called when an event you are subscribed to occurs.
 
void executeRT () override
 
- Public Member Functions inherited from openmsx::OutputSurface
 OutputSurface (const OutputSurface &)=delete
 
OutputSurfaceoperator= (const OutputSurface &)=delete
 
virtual ~OutputSurface ()=default
 
int getLogicalWidth () const
 
int getLogicalHeight () const
 
gl::ivec2 getLogicalSize () const
 
gl::ivec2 getPhysicalSize () const
 
gl::ivec2 getViewOffset () const
 
gl::ivec2 getViewSize () const
 
gl::vec2 getViewScale () const
 
uint32_t mapRGB (gl::vec3 rgb) const
 Returns the pixel value for the given RGB color.
 
uint32_t mapRGB255 (gl::ivec3 rgb) const
 Same as mapRGB, but RGB components are in range [0..255].
 
Pixel getKeyColor () const
 Returns the color key for this output surface.
 
- Public Member Functions inherited from openmsx::EventListener
 EventListener (const EventListener &)=delete
 
EventListeneroperator= (const EventListener &)=delete
 

Static Public Member Functions

static void saveScreenshotGL (const OutputSurface &output, const std::string &filename)
 

Public Attributes

bool guiActive = false
 

Additional Inherited Members

- Public Types inherited from openmsx::OutputSurface
using Pixel = uint32_t
 
- Protected Member Functions inherited from openmsx::OutputSurface
 OutputSurface ()=default
 
void calculateViewPort (gl::ivec2 logSize, gl::ivec2 physSize)
 
- Protected Member Functions inherited from openmsx::EventListener
 EventListener ()=default
 
 ~EventListener ()=default
 

Detailed Description

An OutputSurface which is visible to the user, such as a window or a full screen display.

Definition at line 28 of file VisibleSurface.hh.

Constructor & Destructor Documentation

◆ VisibleSurface()

openmsx::VisibleSurface::VisibleSurface ( Display display,
RTScheduler rtScheduler,
EventDistributor eventDistributor,
InputEventGenerator inputEventGenerator,
CliComm cliComm,
VideoSystem videoSystem 
)

◆ ~VisibleSurface()

openmsx::VisibleSurface::~VisibleSurface ( )
override

Member Function Documentation

◆ createImGUILayer()

std::unique_ptr< Layer > openmsx::VisibleSurface::createImGUILayer ( ImGuiManager manager)

Definition at line 385 of file VisibleSurface.cc.

◆ createOffScreenSurface()

std::unique_ptr< OutputSurface > openmsx::VisibleSurface::createOffScreenSurface ( )

Create an off-screen OutputSurface which has similar properties as this VisibleSurface.

E.g. used to re-render the current frame without OSD elements to take a screenshot.

Definition at line 390 of file VisibleSurface.cc.

◆ createOSDGUILayer()

std::unique_ptr< Layer > openmsx::VisibleSurface::createOSDGUILayer ( OSDGUI gui)

Definition at line 380 of file VisibleSurface.cc.

◆ createSnowLayer()

std::unique_ptr< Layer > openmsx::VisibleSurface::createSnowLayer ( )

Definition at line 375 of file VisibleSurface.cc.

References getDisplay().

◆ executeRT()

void openmsx::VisibleSurface::executeRT ( )
overridevirtual

◆ finish()

void openmsx::VisibleSurface::finish ( )

When a complete frame is finished, call this method.

It will 'actually' display it. E.g. when using double buffering it will swap the front and back buffer.

Definition at line 370 of file VisibleSurface.cc.

◆ fullScreenUpdated()

void openmsx::VisibleSurface::fullScreenUpdated ( bool  fullScreen)

Definition at line 443 of file VisibleSurface.cc.

References openmsx::OutputSurface::getLogicalSize().

Referenced by setFullScreen().

◆ getCliComm()

CliComm & openmsx::VisibleSurface::getCliComm ( ) const
inline

Definition at line 40 of file VisibleSurface.hh.

◆ getDisplay()

Display & openmsx::VisibleSurface::getDisplay ( ) const
inline

Definition at line 41 of file VisibleSurface.hh.

Referenced by createSnowLayer(), and updateWindowTitle().

◆ getWindowPosition()

std::optional< gl::ivec2 > openmsx::VisibleSurface::getWindowPosition ( ) const

Returns x,y coordinates of top-left window corner, or returns a nullopt when in fullscreen mode.

Definition at line 185 of file VisibleSurface.cc.

Referenced by ~VisibleSurface().

◆ resize()

void openmsx::VisibleSurface::resize ( )

◆ saveScreenshot()

void openmsx::VisibleSurface::saveScreenshot ( const std::string &  filename)
overridevirtual

Save the content of this OutputSurface to a PNG file.

Exceptions
MSXExceptionIf creating the PNG file fails.

Implements openmsx::OutputSurface.

Definition at line 347 of file VisibleSurface.cc.

References saveScreenshotGL().

◆ saveScreenshotGL()

void openmsx::VisibleSurface::saveScreenshotGL ( const OutputSurface output,
const std::string &  filename 
)
static

◆ setFullScreen()

bool openmsx::VisibleSurface::setFullScreen ( bool  fullscreen)

Definition at line 306 of file VisibleSurface.cc.

References fullScreenUpdated().

◆ setWindowPosition()

void openmsx::VisibleSurface::setWindowPosition ( gl::ivec2  pos)

Definition at line 193 of file VisibleSurface.cc.

◆ signalEvent()

int openmsx::VisibleSurface::signalEvent ( const Event event)
overridevirtual

This method gets called when an event you are subscribed to occurs.

Returns
Must return a bitmask of EventListener priorities. When a bit is set, this event won't be delivered to listeners with that priority. It's only allowed/possible to block an event for listeners with a strictly lower priority than this listener. Returning 0 means don't block the event for any listeners.

Implements openmsx::EventListener.

Definition at line 272 of file VisibleSurface.cc.

References openmsx::getType(), guiActive, and openmsx::IMGUI_ACTIVE.

◆ update()

void openmsx::VisibleSurface::update ( const Setting setting)
overridevirtualnoexcept

Implements openmsx::Observer< Setting >.

Definition at line 260 of file VisibleSurface.cc.

◆ updateWindowTitle()

void openmsx::VisibleSurface::updateWindowTitle ( )

Definition at line 341 of file VisibleSurface.cc.

References getDisplay().

Member Data Documentation

◆ guiActive

bool openmsx::VisibleSurface::guiActive = false

Definition at line 85 of file VisibleSurface.hh.

Referenced by signalEvent().


The documentation for this class was generated from the following files: