openMSX
|
An OutputSurface which is visible to the user, such as a window or a full screen display. More...
#include <VisibleSurface.hh>
Public Member Functions | |
VisibleSurface (Display &display, RTScheduler &rtScheduler, EventDistributor &eventDistributor, InputEventGenerator &inputEventGenerator, CliComm &cliComm, VideoSystem &videoSystem) | |
~VisibleSurface () override | |
CliComm & | getCliComm () const |
Display & | getDisplay () const |
void | updateWindowTitle () |
bool | setFullScreen (bool fullscreen) |
void | resize () |
void | finish () |
When a complete frame is finished, call this method. More... | |
std::unique_ptr< Layer > | createSnowLayer () |
std::unique_ptr< Layer > | createOSDGUILayer (OSDGUI &gui) |
std::unique_ptr< Layer > | createImGUILayer (ImGuiManager &manager) |
std::unique_ptr< OutputSurface > | createOffScreenSurface () |
Create an off-screen OutputSurface which has similar properties as this VisibleSurface. More... | |
void | fullScreenUpdated (bool fullScreen) |
std::optional< gl::ivec2 > | getWindowPosition () const |
Returns x,y coordinates of top-left window corner, or returns a nullopt when in fullscreen mode. More... | |
void | setWindowPosition (gl::ivec2 pos) |
void | saveScreenshot (const std::string &filename) override |
Save the content of this OutputSurface to a PNG file. More... | |
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. More... | |
void | executeRT () override |
![]() | |
OutputSurface (const OutputSurface &)=delete | |
OutputSurface & | operator= (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. More... | |
uint32_t | mapRGB255 (gl::ivec3 rgb) const |
Same as mapRGB, but RGB components are in range [0..255]. More... | |
Pixel | getKeyColor () const |
Returns the color key for this output surface. More... | |
virtual void | saveScreenshot (const std::string &filename)=0 |
Save the content of this OutputSurface to a PNG file. More... | |
![]() | |
EventListener (const EventListener &)=delete | |
EventListener & | operator= (const EventListener &)=delete |
virtual int | signalEvent (const Event &event)=0 |
This method gets called when an event you are subscribed to occurs. More... | |
Static Public Member Functions | |
static void | saveScreenshotGL (const OutputSurface &output, const std::string &filename) |
Public Attributes | |
bool | guiActive = false |
Additional Inherited Members | |
![]() | |
using | Pixel = uint32_t |
![]() | |
OutputSurface ()=default | |
void | calculateViewPort (gl::ivec2 logSize, gl::ivec2 physSize) |
![]() | |
EventListener ()=default | |
~EventListener ()=default | |
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.
openmsx::VisibleSurface::VisibleSurface | ( | Display & | display, |
RTScheduler & | rtScheduler, | ||
EventDistributor & | eventDistributor, | ||
InputEventGenerator & | inputEventGenerator, | ||
CliComm & | cliComm, | ||
VideoSystem & | videoSystem | ||
) |
Definition at line 40 of file VisibleSurface.cc.
References openmsx::Subject< T >::attach(), gl::context, openmsx::InputEventGenerator::getGrabInput(), openmsx::Display::getRenderSettings(), openmsx::IMGUI_ACTIVE, ImGui_ImplOpenGL3_Init(), ImGui_ImplSDL2_InitForOpenGL(), openmsx::MOUSE_BUTTON_DOWN, openmsx::MOUSE_BUTTON_UP, openmsx::MOUSE_MOTION, openmsx::EventDistributor::registerEventListener(), openmsx::WindowEvent::setMainWindowId(), and VERSION_STRING.
|
override |
Definition at line 153 of file VisibleSurface.cc.
References gl::context, openmsx::Subject< T >::detach(), openmsx::InputEventGenerator::getGrabInput(), openmsx::Display::getRenderSettings(), openmsx::RenderSettings::getVSyncSetting(), getWindowPosition(), openmsx::IMGUI_ACTIVE, ImGui_ImplOpenGL3_Shutdown(), ImGui_ImplSDL2_Shutdown(), openmsx::MOUSE_BUTTON_DOWN, openmsx::MOUSE_BUTTON_UP, openmsx::MOUSE_MOTION, openmsx::Display::storeWindowPosition(), and openmsx::EventDistributor::unregisterEventListener().
std::unique_ptr< Layer > openmsx::VisibleSurface::createImGUILayer | ( | ImGuiManager & | manager | ) |
Definition at line 380 of file VisibleSurface.cc.
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 385 of file VisibleSurface.cc.
Definition at line 375 of file VisibleSurface.cc.
std::unique_ptr< Layer > openmsx::VisibleSurface::createSnowLayer | ( | ) |
Definition at line 370 of file VisibleSurface.cc.
References getDisplay().
|
overridevirtual |
Implements openmsx::RTSchedulable.
Definition at line 260 of file VisibleSurface.cc.
References openmsx::VideoSystem::showCursor(), and openmsx::InputEventGenerator::updateGrab().
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 365 of file VisibleSurface.cc.
void openmsx::VisibleSurface::fullScreenUpdated | ( | bool | fullScreen | ) |
Definition at line 438 of file VisibleSurface.cc.
References openmsx::OutputSurface::getLogicalSize().
Referenced by setFullScreen().
|
inline |
Definition at line 40 of file VisibleSurface.hh.
|
inline |
Definition at line 41 of file VisibleSurface.hh.
Referenced by createSnowLayer(), and updateWindowTitle().
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 180 of file VisibleSurface.cc.
Referenced by ~VisibleSurface().
void openmsx::VisibleSurface::resize | ( | ) |
Definition at line 327 of file VisibleSurface.cc.
References openmsx::RenderSettings::getFullScreen(), openmsx::Display::getRenderSettings(), and utf8::unchecked::size().
|
overridevirtual |
Save the content of this OutputSurface to a PNG file.
MSXException | If creating the PNG file fails. |
Implements openmsx::OutputSurface.
Definition at line 342 of file VisibleSurface.cc.
References saveScreenshotGL().
|
static |
Definition at line 347 of file VisibleSurface.cc.
References openmsx::MemBuffer< T, ALIGNMENT >::data(), openmsx::OutputSurface::getViewOffset(), openmsx::OutputSurface::getViewSize(), openmsx::PNG::saveRGBA(), VLA, and xrange().
Referenced by saveScreenshot().
bool openmsx::VisibleSurface::setFullScreen | ( | bool | fullscreen | ) |
Definition at line 301 of file VisibleSurface.cc.
References fullScreenUpdated().
void openmsx::VisibleSurface::setWindowPosition | ( | gl::ivec2 | pos | ) |
Definition at line 188 of file VisibleSurface.cc.
|
overridevirtual |
This method gets called when an event you are subscribed to occurs.
Implements openmsx::EventListener.
Definition at line 267 of file VisibleSurface.cc.
References openmsx::getType(), guiActive, and openmsx::IMGUI_ACTIVE.
|
overridevirtualnoexcept |
Implements openmsx::Observer< Setting >.
Definition at line 255 of file VisibleSurface.cc.
void openmsx::VisibleSurface::updateWindowTitle | ( | ) |
Definition at line 336 of file VisibleSurface.cc.
References getDisplay().
bool openmsx::VisibleSurface::guiActive = false |
Definition at line 85 of file VisibleSurface.hh.
Referenced by signalEvent().