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. | |
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. | |
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. | |
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 |
bool | 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 | |
OutputSurface (OutputSurface &&)=delete | |
OutputSurface & | operator= (const OutputSurface &)=delete |
OutputSurface & | operator= (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 | |
EventListener (EventListener &&)=delete | |
EventListener & | operator= (const EventListener &)=delete |
EventListener & | operator= (EventListener &&)=delete |
Static Public Member Functions | |
static void | saveScreenshotGL (const OutputSurface &output, const std::string &filename) |
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 | |
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 41 of file VisibleSurface.cc.
References openmsx::Subject< T >::attach(), gl::context, openmsx::InputEventGenerator::getGrabInput(), openmsx::Display::getRenderSettings(), openmsx::Display::getWindowSize(), 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 155 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 378 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 383 of file VisibleSurface.cc.
Definition at line 373 of file VisibleSurface.cc.
std::unique_ptr< Layer > openmsx::VisibleSurface::createSnowLayer | ( | ) |
Definition at line 368 of file VisibleSurface.cc.
References getDisplay().
|
overridevirtual |
Implements openmsx::RTSchedulable.
Definition at line 265 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 363 of file VisibleSurface.cc.
void openmsx::VisibleSurface::fullScreenUpdated | ( | bool | fullScreen | ) |
Definition at line 436 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 185 of file VisibleSurface.cc.
Referenced by ~VisibleSurface().
void openmsx::VisibleSurface::resize | ( | ) |
Definition at line 325 of file VisibleSurface.cc.
References openmsx::RenderSettings::getFullScreen(), openmsx::Display::getRenderSettings(), and openmsx::Display::getWindowSize().
|
overridevirtual |
Save the content of this OutputSurface to a PNG file.
MSXException | If creating the PNG file fails. |
Implements openmsx::OutputSurface.
Definition at line 340 of file VisibleSurface.cc.
References saveScreenshotGL().
|
static |
Definition at line 345 of file VisibleSurface.cc.
References openmsx::MemBuffer< T, ALIGNMENT >::data(), openmsx::OutputSurface::getViewOffset(), openmsx::OutputSurface::getViewSize(), openmsx::PNG::saveRGBA(), view::transform(), and xrange().
Referenced by saveScreenshot().
bool openmsx::VisibleSurface::setFullScreen | ( | bool | fullscreen | ) |
Definition at line 306 of file VisibleSurface.cc.
References fullScreenUpdated().
void openmsx::VisibleSurface::setWindowPosition | ( | gl::ivec2 | pos | ) |
Definition at line 193 of file VisibleSurface.cc.
|
overridevirtual |
This method gets called when an event you are subscribed to occurs.
Implements openmsx::EventListener.
Definition at line 272 of file VisibleSurface.cc.
References openmsx::getType(), and openmsx::IMGUI_ACTIVE.
|
overridevirtualnoexcept |
Implements openmsx::Observer< Setting >.
Definition at line 260 of file VisibleSurface.cc.
void openmsx::VisibleSurface::updateWindowTitle | ( | ) |
Definition at line 334 of file VisibleSurface.cc.
References getDisplay().