Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
openmsx::VisibleSurface Class Referenceabstract

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
Collaboration diagram for openmsx::VisibleSurface:
Collaboration graph

Public Member Functions

 ~VisibleSurface () override
void updateWindowTitle ()
bool setFullScreen (bool fullscreen)
virtual void finish ()=0
 When a complete frame is finished, call this method. More...
virtual std::unique_ptr< LayercreateSnowLayer ()=0
virtual std::unique_ptr< LayercreateConsoleLayer (Reactor &reactor, CommandConsole &console)=0
virtual std::unique_ptr< LayercreateOSDGUILayer (OSDGUI &gui)=0
virtual std::unique_ptr< OutputSurfacecreateOffScreenSurface ()=0
 Create an off-screen OutputSurface which has similar properties as this VisibleSurface. More...
DisplaygetDisplay () const
- Public Member Functions inherited from openmsx::OutputSurface
 OutputSurface (const OutputSurface &)=delete
OutputSurfaceoperator= (const OutputSurface &)=delete
virtual ~OutputSurface ()=default
int getWidth () const
int getHeight () const
gl::ivec2 getLogicalSize () const
gl::ivec2 getPhysicalSize () const
gl::ivec2 getViewOffset () const
gl::ivec2 getViewSize () const
gl::vec2 getViewScale () const
bool isViewScaled () const
const SDL_PixelFormat & getSDLFormat () const
SDL_Surface * getSDLSurface () const
SDL_Renderer * getSDLRenderer () const
unsigned mapRGB (gl::vec3 rgb)
 Returns the pixel value for the given RGB color. More...
unsigned mapRGB255 (gl::ivec3 rgb)
 Same as mapRGB, but RGB components are in range [0..255]. More...
template<typename Pixel >
Pixel getKeyColor () const
 Returns the color key for this output surface. More...
template<typename Pixel >
Pixel getKeyColorClash () const
 Returns a color that is visually very close to the key color. More...
template<typename Pixel >
Pixel mapKeyedRGB255 (gl::ivec3 rgb)
 Returns the pixel value for the given RGB color. More...
template<typename Pixel >
Pixel mapKeyedRGB (gl::vec3 rgb)
 Returns the pixel value for the given RGB color. More...
void lock ()
 Lock this OutputSurface. More...
void unlock ()
 Unlock this OutputSurface. More...
bool isLocked () const
 Is this OutputSurface currently locked? More...
template<typename Pixel >
PixelgetLinePtrDirect (unsigned y)
 Returns a pointer to the requested line in the pixel buffer. More...
virtual void flushFrameBuffer ()
 For SDLGL-FB-nn, copy frame buffer to OpenGL display. More...
virtual void saveScreenshot (const std::string &filename)=0
 Save the content of this OutputSurface to a PNG file. More...
virtual void clearScreen ()=0
 Clear screen (paint it black). More...

Protected Member Functions

 VisibleSurface (Display &display, RTScheduler &rtScheduler, EventDistributor &eventDistributor, InputEventGenerator &inputEventGenerator, CliComm &cliComm)
void createSurface (int width, int height, unsigned flags)
- Protected Member Functions inherited from openmsx::OutputSurface
 OutputSurface ()=default
void calculateViewPort (gl::ivec2 physSize)
void setSDLSurface (SDL_Surface *surface_)
void setSDLRenderer (SDL_Renderer *r)
void setSDLFormat (const SDL_PixelFormat &format)
void setBufferPtr (char *data, unsigned pitch)
- Protected Member Functions inherited from openmsx::EventListener
 EventListener ()=default
 ~EventListener ()=default

Protected Attributes

SDLSubSystemInitializer< SDL_INIT_VIDEO > videoSubSystem
SDLWindowPtr window
SDLRendererPtr renderer
SDLSurfacePtr surface
SDLTexturePtr texture

Detailed Description

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

This class provides a frame buffer based renderer a common interface, no matter whether the back-end is plain SDL or SDL+OpenGL.

Definition at line 28 of file VisibleSurface.hh.

Constructor & Destructor Documentation

◆ ~VisibleSurface()

openmsx::VisibleSurface::~VisibleSurface ( )

◆ VisibleSurface()

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

Member Function Documentation

◆ createConsoleLayer()

virtual std::unique_ptr<Layer> openmsx::VisibleSurface::createConsoleLayer ( Reactor reactor,
CommandConsole console 
pure virtual

◆ createOffScreenSurface()

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

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.

◆ createOSDGUILayer()

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

◆ createSnowLayer()

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

◆ createSurface()

void openmsx::VisibleSurface::createSurface ( int  width,
int  height,
unsigned  flags 

◆ finish()

virtual void openmsx::VisibleSurface::finish ( )
pure virtual

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.

◆ getDisplay()

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

◆ setFullScreen()

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

◆ updateWindowTitle()

void openmsx::VisibleSurface::updateWindowTitle ( )

Definition at line 141 of file

References openmsx::Display::getWindowTitle(), and window.

Referenced by createSurface().

Member Data Documentation

◆ renderer

SDLRendererPtr openmsx::VisibleSurface::renderer

Definition at line 65 of file VisibleSurface.hh.

Referenced by createSurface().

◆ surface

SDLSurfacePtr openmsx::VisibleSurface::surface

Definition at line 66 of file VisibleSurface.hh.

Referenced by createSurface().

◆ texture

SDLTexturePtr openmsx::VisibleSurface::texture

◆ videoSubSystem

SDLSubSystemInitializer<SDL_INIT_VIDEO> openmsx::VisibleSurface::videoSubSystem

Definition at line 63 of file VisibleSurface.hh.

◆ window

SDLWindowPtr openmsx::VisibleSurface::window

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