Skip to content

Commit

Permalink
BACKENDS: Add a function to return if the overlay is visible
Browse files Browse the repository at this point in the history
  • Loading branch information
ccawley2011 authored and sev- committed Sep 14, 2020
1 parent 3f38c0f commit 31be074
Show file tree
Hide file tree
Showing 16 changed files with 32 additions and 2 deletions.
1 change: 1 addition & 0 deletions backends/graphics/graphics.h
Expand Up @@ -91,6 +91,7 @@ class GraphicsManager : public PaletteManager {

virtual void showOverlay() = 0;
virtual void hideOverlay() = 0;
virtual bool isOverlayVisible() const = 0;
virtual Graphics::PixelFormat getOverlayFormat() const = 0;
virtual void clearOverlay() = 0;
virtual void grabOverlay(void *buf, int pitch) const = 0;
Expand Down
6 changes: 4 additions & 2 deletions backends/graphics/null/null-graphics.h
Expand Up @@ -72,8 +72,9 @@ class NullGraphicsManager : public GraphicsManager {
void setFocusRectangle(const Common::Rect& rect) override {}
void clearFocusRectangle() override {}

void showOverlay() override {}
void hideOverlay() override {}
void showOverlay() override { _overlayVisible = true; }
void hideOverlay() override { _overlayVisible = false; }
bool isOverlayVisible() const override { return _overlayVisible; }
Graphics::PixelFormat getOverlayFormat() const override { return Graphics::PixelFormat(2, 5, 6, 5, 0, 11, 5, 0, 0); }
void clearOverlay() override {}
void grabOverlay(void *buf, int pitch) const override {}
Expand All @@ -89,6 +90,7 @@ class NullGraphicsManager : public GraphicsManager {
private:
uint _width, _height;
Graphics::PixelFormat _format;
bool _overlayVisible;
};

#endif
2 changes: 2 additions & 0 deletions backends/graphics/windowed.h
Expand Up @@ -77,6 +77,8 @@ class WindowedGraphicsManager : virtual public GraphicsManager {
_forceRedraw = true;
}

virtual bool isOverlayVisible() const override { return _overlayVisible; }

virtual void setShakePos(int shakeXOffset, int shakeYOffset) override {
if (_gameScreenShakeXOffset != shakeXOffset || _gameScreenShakeYOffset != shakeYOffset) {
_gameScreenShakeXOffset = shakeXOffset;
Expand Down
4 changes: 4 additions & 0 deletions backends/modular-backend.cpp
Expand Up @@ -202,6 +202,10 @@ void ModularGraphicsBackend::hideOverlay() {
_graphicsManager->hideOverlay();
}

bool ModularGraphicsBackend::isOverlayVisible() const {
return _graphicsManager->isOverlayVisible();
}

Graphics::PixelFormat ModularGraphicsBackend::getOverlayFormat() const {
return _graphicsManager->getOverlayFormat();
}
Expand Down
1 change: 1 addition & 0 deletions backends/modular-backend.h
Expand Up @@ -102,6 +102,7 @@ class ModularGraphicsBackend : virtual public BaseBackend {

virtual void showOverlay() override final;
virtual void hideOverlay() override final;
virtual bool isOverlayVisible() const override final;
virtual Graphics::PixelFormat getOverlayFormat() const override final;
virtual void clearOverlay() override final;
virtual void grabOverlay(void *buf, int pitch) override final;
Expand Down
1 change: 1 addition & 0 deletions backends/platform/3ds/osystem.h
Expand Up @@ -159,6 +159,7 @@ class OSystem_3DS : public EventsBaseBackend, public PaletteManager, public Comm
void clearFocusRectangle();
void showOverlay();
void hideOverlay();
bool isOverlayVisible() const { return _overlayVisible; }
Graphics::PixelFormat getOverlayFormat() const;
void clearOverlay();
void grabOverlay(void *buf, int pitch);
Expand Down
1 change: 1 addition & 0 deletions backends/platform/dc/dc.h
Expand Up @@ -154,6 +154,7 @@ class OSystem_Dreamcast : private DCHardware, public EventsBaseBackend, public P
// Overlay
int16 getOverlayHeight();
int16 getOverlayWidth();
bool isOverlayVisible() const { return _overlay_visible; }
void showOverlay();
void hideOverlay();
void clearOverlay();
Expand Down
4 changes: 4 additions & 0 deletions backends/platform/ds/arm9/source/osystem_ds.cpp
Expand Up @@ -486,6 +486,10 @@ void OSystem_DS::hideOverlay() {
DS::displayMode8Bit();
}

bool OSystem_DS::isOverlayVisible() const {
return !DS::getIsDisplayMode8Bit();
}

void OSystem_DS::clearOverlay() {
memset((u16 *) DS::get16BitBackBuffer(), 0, 512 * 256 * 2);
// consolePrintf("clearovl\n");
Expand Down
1 change: 1 addition & 0 deletions backends/platform/ds/arm9/source/osystem_ds.h
Expand Up @@ -102,6 +102,7 @@ class OSystem_DS : public EventsBaseBackend, public PaletteManager {

virtual void showOverlay();
virtual void hideOverlay();
virtual bool isOverlayVisible() const;
virtual void clearOverlay();
virtual void grabOverlay(void *buf, int pitch);
virtual void copyRectToOverlay(const void *buf, int pitch, int x, int y, int w, int h);
Expand Down
1 change: 1 addition & 0 deletions backends/platform/ios7/ios7_osys_main.h
Expand Up @@ -166,6 +166,7 @@ class OSystem_iOS7 : public EventsBaseBackend, public PaletteManager {

virtual void showOverlay();
virtual void hideOverlay();
virtual bool isOverlayVisible() const { return _videoContext->overlayVisible; }
virtual void clearOverlay();
virtual void grabOverlay(void *buf, int pitch);
virtual void copyRectToOverlay(const void *buf, int pitch, int x, int y, int w, int h);
Expand Down
1 change: 1 addition & 0 deletions backends/platform/iphone/osys_main.h
Expand Up @@ -154,6 +154,7 @@ class OSystem_IPHONE : public EventsBaseBackend, public PaletteManager {

virtual void showOverlay();
virtual void hideOverlay();
virtual bool isOverlayVisible() const { return _videoContext->overlayVisible; }
virtual void clearOverlay();
virtual void grabOverlay(void *buf, int pitch);
virtual void copyRectToOverlay(const void *buf, int pitch, int x, int y, int w, int h);
Expand Down
1 change: 1 addition & 0 deletions backends/platform/n64/osys_n64.h
Expand Up @@ -167,6 +167,7 @@ class OSystem_N64 : public EventsBaseBackend, public PaletteManager {

virtual void showOverlay();
virtual void hideOverlay();
virtual bool isOverlayVisible() const { return _overlayVisible; }
virtual void clearOverlay();
virtual void grabOverlay(void *buf, int pitch);
virtual void copyRectToOverlay(const void *buf, int pitch, int x, int y, int w, int h);
Expand Down
5 changes: 5 additions & 0 deletions backends/platform/psp/osys_psp.cpp
Expand Up @@ -246,6 +246,11 @@ void OSystem_PSP::hideOverlay() {
_cursor.useGlobalScaler(true); // mouse needs to be scaled with screen
}

bool OSystem_PSP::isOverlayVisible() const {
DEBUG_ENTER_FUNC();
return _overlay.isVisible();
}

void OSystem_PSP::clearOverlay() {
DEBUG_ENTER_FUNC();
_displayManager.waitUntilRenderFinished();
Expand Down
1 change: 1 addition & 0 deletions backends/platform/psp/osys_psp.h
Expand Up @@ -104,6 +104,7 @@ class OSystem_PSP : public EventsBaseBackend, public PaletteManager {
// Overlay related
void showOverlay();
void hideOverlay();
bool isOverlayVisible() const;
void clearOverlay();
void grabOverlay(void *buf, int pitch);
void copyRectToOverlay(const void *buf, int pitch, int x, int y, int w, int h);
Expand Down
1 change: 1 addition & 0 deletions backends/platform/wii/osystem.h
Expand Up @@ -176,6 +176,7 @@ class OSystem_Wii : public EventsBaseBackend, public PaletteManager {

virtual void showOverlay();
virtual void hideOverlay();
virtual bool isOverlayVisible() const { return _overlayVisible; }
virtual void clearOverlay();
virtual void grabOverlay(void *buf, int pitch);
virtual void copyRectToOverlay(const void *buf, int pitch,
Expand Down
3 changes: 3 additions & 0 deletions common/system.h
Expand Up @@ -999,6 +999,9 @@ class OSystem : Common::NonCopyable {
/** Deactivate the overlay mode. */
virtual void hideOverlay() = 0;

/** Returns true if the overlay mode is activated, false otherwise. */
virtual bool isOverlayVisible() const = 0;

/**
* Returns the pixel format description of the overlay.
* @see Graphics::PixelFormat
Expand Down

0 comments on commit 31be074

Please sign in to comment.