COMMON: Allow games to use overlay for something else than GUI
This can be used for subtitles without changing the mouse coordinates.
This commit is contained in:
parent
c04b48db55
commit
87bad2cc7d
43 changed files with 229 additions and 133 deletions
|
@ -154,13 +154,19 @@ void AndroidGraphicsManager::displayMessageOnOSD(const Common::U32String &msg) {
|
||||||
JNI::displayMessageOnOSD(msg);
|
JNI::displayMessageOnOSD(msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AndroidGraphicsManager::showOverlay() {
|
void AndroidGraphicsManager::showOverlay(bool inGUI) {
|
||||||
if (_overlayVisible)
|
if (_overlayVisible && inGUI == _overlayInGUI)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
_old_touch_mode = JNI::getTouchMode();
|
// Don't change touch mode when not changing mouse coordinates
|
||||||
// not in 3D, in overlay
|
if (inGUI) {
|
||||||
dynamic_cast<OSystem_Android *>(g_system)->applyTouchSettings(false, true);
|
_old_touch_mode = JNI::getTouchMode();
|
||||||
|
// not in 3D, in overlay
|
||||||
|
dynamic_cast<OSystem_Android *>(g_system)->applyTouchSettings(false, true);
|
||||||
|
} else if (_overlayInGUI) {
|
||||||
|
// Restore touch mode active before overlay was shown
|
||||||
|
JNI::setTouchMode(_old_touch_mode);
|
||||||
|
}
|
||||||
|
|
||||||
OpenGL::OpenGLGraphicsManager::showOverlay();
|
OpenGL::OpenGLGraphicsManager::showOverlay();
|
||||||
}
|
}
|
||||||
|
@ -169,8 +175,10 @@ void AndroidGraphicsManager::hideOverlay() {
|
||||||
if (!_overlayVisible)
|
if (!_overlayVisible)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// Restore touch mode active before overlay was shown
|
if (_overlayInGUI) {
|
||||||
JNI::setTouchMode(_old_touch_mode);
|
// Restore touch mode active before overlay was shown
|
||||||
|
JNI::setTouchMode(_old_touch_mode);
|
||||||
|
}
|
||||||
|
|
||||||
OpenGL::OpenGLGraphicsManager::hideOverlay();
|
OpenGL::OpenGLGraphicsManager::hideOverlay();
|
||||||
}
|
}
|
||||||
|
|
|
@ -90,7 +90,7 @@ public:
|
||||||
protected:
|
protected:
|
||||||
void setSystemMousePosition(const int x, const int y) override {}
|
void setSystemMousePosition(const int x, const int y) override {}
|
||||||
|
|
||||||
void showOverlay() override;
|
void showOverlay(bool inGUI) override;
|
||||||
void hideOverlay() override;
|
void hideOverlay() override;
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -86,7 +86,7 @@ public:
|
||||||
virtual void setFocusRectangle(const Common::Rect& rect) = 0;
|
virtual void setFocusRectangle(const Common::Rect& rect) = 0;
|
||||||
virtual void clearFocusRectangle() = 0;
|
virtual void clearFocusRectangle() = 0;
|
||||||
|
|
||||||
virtual void showOverlay() = 0;
|
virtual void showOverlay(bool inGUI) = 0;
|
||||||
virtual void hideOverlay() = 0;
|
virtual void hideOverlay() = 0;
|
||||||
virtual bool isOverlayVisible() const = 0;
|
virtual bool isOverlayVisible() const = 0;
|
||||||
virtual Graphics::PixelFormat getOverlayFormat() const = 0;
|
virtual Graphics::PixelFormat getOverlayFormat() const = 0;
|
||||||
|
|
|
@ -71,7 +71,7 @@ public:
|
||||||
void setFocusRectangle(const Common::Rect& rect) override {}
|
void setFocusRectangle(const Common::Rect& rect) override {}
|
||||||
void clearFocusRectangle() override {}
|
void clearFocusRectangle() override {}
|
||||||
|
|
||||||
void showOverlay() override { _overlayVisible = true; }
|
void showOverlay(bool inGUI) override { _overlayVisible = true; }
|
||||||
void hideOverlay() override { _overlayVisible = false; }
|
void hideOverlay() override { _overlayVisible = false; }
|
||||||
bool isOverlayVisible() const override { return _overlayVisible; }
|
bool isOverlayVisible() const override { return _overlayVisible; }
|
||||||
Graphics::PixelFormat getOverlayFormat() const override { return Graphics::PixelFormat(2, 5, 6, 5, 0, 11, 5, 0, 0); }
|
Graphics::PixelFormat getOverlayFormat() const override { return Graphics::PixelFormat(2, 5, 6, 5, 0, 11, 5, 0, 0); }
|
||||||
|
|
|
@ -636,35 +636,56 @@ void OpenGLGraphicsManager::updateScreen() {
|
||||||
// Clear the screen buffer.
|
// Clear the screen buffer.
|
||||||
GL_CALL(glClear(GL_COLOR_BUFFER_BIT));
|
GL_CALL(glClear(GL_COLOR_BUFFER_BIT));
|
||||||
|
|
||||||
if (!_overlayVisible) {
|
if (!_overlayInGUI) {
|
||||||
// The scissor test is enabled to:
|
// The scissor test is enabled to:
|
||||||
// - Clip the cursor to the game screen
|
// - Clip the cursor to the game screen
|
||||||
// - Clip the game screen when the shake offset is non-zero
|
// - Clip the game screen when the shake offset is non-zero
|
||||||
_backBuffer.enableScissorTest(true);
|
_backBuffer.enableScissorTest(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Don't draw cursor if it's not visible or there is none
|
||||||
|
bool drawCursor = _cursorVisible && _cursor;
|
||||||
|
|
||||||
// Alpha blending is disabled when drawing the screen
|
// Alpha blending is disabled when drawing the screen
|
||||||
_backBuffer.enableBlend(Framebuffer::kBlendModeDisabled);
|
_backBuffer.enableBlend(Framebuffer::kBlendModeDisabled);
|
||||||
|
|
||||||
// First step: Draw the (virtual) game screen.
|
// First step: Draw the (virtual) game screen.
|
||||||
_pipeline->drawTexture(_gameScreen->getGLTexture(), _gameDrawRect.left, _gameDrawRect.top, _gameDrawRect.width(), _gameDrawRect.height());
|
_pipeline->drawTexture(_gameScreen->getGLTexture(), _gameDrawRect.left, _gameDrawRect.top, _gameDrawRect.width(), _gameDrawRect.height());
|
||||||
|
|
||||||
// Second step: Draw the overlay if visible.
|
// Second step: Draw the cursor if necessary and we are not in GUI and it
|
||||||
if (_overlayVisible) {
|
|
||||||
#if !USE_FORCED_GLES
|
#if !USE_FORCED_GLES
|
||||||
// Overlay must not be scaled and its cursor won't be either
|
if (_libretroPipeline) {
|
||||||
if (_libretroPipeline) {
|
// If we are in game, draw the cursor through scaler
|
||||||
_libretroPipeline->finishScaling();
|
// This has the disadvantage of having overlay (subtitles) drawn above it
|
||||||
|
// but the cursor will look nicer
|
||||||
|
if (!_overlayInGUI && drawCursor) {
|
||||||
|
_backBuffer.enableBlend(Framebuffer::kBlendModePremultipliedTransparency);
|
||||||
|
|
||||||
|
_pipeline->drawTexture(_cursor->getGLTexture(),
|
||||||
|
_cursorX - _cursorHotspotXScaled + _shakeOffsetScaled.x,
|
||||||
|
_cursorY - _cursorHotspotYScaled + _shakeOffsetScaled.y,
|
||||||
|
_cursorWidthScaled, _cursorHeightScaled);
|
||||||
|
drawCursor = false;
|
||||||
|
|
||||||
|
// Everything we need to clip has been clipped
|
||||||
|
_backBuffer.enableScissorTest(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Overlay must not be scaled and its cursor won't be either
|
||||||
|
_libretroPipeline->finishScaling();
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// Third step: Draw the overlay if visible.
|
||||||
|
if (_overlayVisible) {
|
||||||
int dstX = (_windowWidth - _overlayDrawRect.width()) / 2;
|
int dstX = (_windowWidth - _overlayDrawRect.width()) / 2;
|
||||||
int dstY = (_windowHeight - _overlayDrawRect.height()) / 2;
|
int dstY = (_windowHeight - _overlayDrawRect.height()) / 2;
|
||||||
_backBuffer.enableBlend(Framebuffer::kBlendModeTraditionalTransparency);
|
_backBuffer.enableBlend(Framebuffer::kBlendModeTraditionalTransparency);
|
||||||
_pipeline->drawTexture(_overlay->getGLTexture(), dstX, dstY, _overlayDrawRect.width(), _overlayDrawRect.height());
|
_pipeline->drawTexture(_overlay->getGLTexture(), dstX, dstY, _overlayDrawRect.width(), _overlayDrawRect.height());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Third step: Draw the cursor if necessary.
|
// Fourth step: Draw the cursor if we didn't before.
|
||||||
if (_cursorVisible && _cursor) {
|
if (drawCursor) {
|
||||||
_backBuffer.enableBlend(Framebuffer::kBlendModePremultipliedTransparency);
|
_backBuffer.enableBlend(Framebuffer::kBlendModePremultipliedTransparency);
|
||||||
|
|
||||||
_pipeline->drawTexture(_cursor->getGLTexture(),
|
_pipeline->drawTexture(_cursor->getGLTexture(),
|
||||||
|
@ -673,13 +694,7 @@ void OpenGLGraphicsManager::updateScreen() {
|
||||||
_cursorWidthScaled, _cursorHeightScaled);
|
_cursorWidthScaled, _cursorHeightScaled);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !USE_FORCED_GLES
|
if (!_overlayInGUI) {
|
||||||
if (_libretroPipeline) {
|
|
||||||
_libretroPipeline->finishScaling();
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (!_overlayVisible) {
|
|
||||||
_backBuffer.enableScissorTest(false);
|
_backBuffer.enableScissorTest(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1448,8 +1463,8 @@ void OpenGLGraphicsManager::recalculateDisplayAreas() {
|
||||||
_gameDrawRect.width(),
|
_gameDrawRect.width(),
|
||||||
_gameDrawRect.height());
|
_gameDrawRect.height());
|
||||||
|
|
||||||
_shakeOffsetScaled = Common::Point(_gameScreenShakeXOffset * _activeArea.drawRect.width() / _activeArea.width,
|
_shakeOffsetScaled = Common::Point(_gameScreenShakeXOffset * _gameDrawRect.width() / _currentState.gameWidth,
|
||||||
_gameScreenShakeYOffset * _activeArea.drawRect.height() / _activeArea.height);
|
_gameScreenShakeYOffset * _gameDrawRect.height() / _currentState.gameHeight);
|
||||||
|
|
||||||
// Update the cursor position to adjust for new display area.
|
// Update the cursor position to adjust for new display area.
|
||||||
setMousePosition(_cursorX, _cursorY);
|
setMousePosition(_cursorX, _cursorY);
|
||||||
|
|
|
@ -1092,7 +1092,7 @@ void SurfaceSdlGraphicsManager::internUpdateScreen() {
|
||||||
(_cursorNeedsRedraw && _mouseBackup.x <= _currentShakeXOffset)) {
|
(_cursorNeedsRedraw && _mouseBackup.x <= _currentShakeXOffset)) {
|
||||||
SDL_Rect blackrect = {0, 0, (Uint16)(_gameScreenShakeXOffset * _videoMode.scaleFactor), (Uint16)(_videoMode.screenHeight * _videoMode.scaleFactor)};
|
SDL_Rect blackrect = {0, 0, (Uint16)(_gameScreenShakeXOffset * _videoMode.scaleFactor), (Uint16)(_videoMode.screenHeight * _videoMode.scaleFactor)};
|
||||||
|
|
||||||
if (_videoMode.aspectRatioCorrection && !_overlayVisible)
|
if (_videoMode.aspectRatioCorrection && !_overlayInGUI)
|
||||||
blackrect.h = real2Aspect(blackrect.h - 1) + 1;
|
blackrect.h = real2Aspect(blackrect.h - 1) + 1;
|
||||||
|
|
||||||
SDL_FillRect(_hwScreen, &blackrect, 0);
|
SDL_FillRect(_hwScreen, &blackrect, 0);
|
||||||
|
@ -1105,7 +1105,7 @@ void SurfaceSdlGraphicsManager::internUpdateScreen() {
|
||||||
(_cursorNeedsRedraw && _mouseBackup.y <= _currentShakeYOffset)) {
|
(_cursorNeedsRedraw && _mouseBackup.y <= _currentShakeYOffset)) {
|
||||||
SDL_Rect blackrect = {0, 0, (Uint16)(_videoMode.screenWidth * _videoMode.scaleFactor), (Uint16)(_gameScreenShakeYOffset * _videoMode.scaleFactor)};
|
SDL_Rect blackrect = {0, 0, (Uint16)(_videoMode.screenWidth * _videoMode.scaleFactor), (Uint16)(_gameScreenShakeYOffset * _videoMode.scaleFactor)};
|
||||||
|
|
||||||
if (_videoMode.aspectRatioCorrection && !_overlayVisible)
|
if (_videoMode.aspectRatioCorrection && !_overlayInGUI)
|
||||||
blackrect.h = real2Aspect(blackrect.h - 1) + 1;
|
blackrect.h = real2Aspect(blackrect.h - 1) + 1;
|
||||||
|
|
||||||
SDL_FillRect(_hwScreen, &blackrect, 0);
|
SDL_FillRect(_hwScreen, &blackrect, 0);
|
||||||
|
@ -1224,7 +1224,7 @@ void SurfaceSdlGraphicsManager::internUpdateScreen() {
|
||||||
dst_x *= scale1;
|
dst_x *= scale1;
|
||||||
dst_y *= scale1;
|
dst_y *= scale1;
|
||||||
|
|
||||||
if (_videoMode.aspectRatioCorrection && !_overlayVisible)
|
if (_videoMode.aspectRatioCorrection && !_overlayInGUI)
|
||||||
dst_y = real2Aspect(dst_y);
|
dst_y = real2Aspect(dst_y);
|
||||||
|
|
||||||
_scaler->scale((byte *)srcSurf->pixels + (r->x + _maxExtraPixels) * 2 + (r->y + _maxExtraPixels) * srcPitch, srcPitch,
|
_scaler->scale((byte *)srcSurf->pixels + (r->x + _maxExtraPixels) * 2 + (r->y + _maxExtraPixels) * srcPitch, srcPitch,
|
||||||
|
@ -1237,7 +1237,7 @@ void SurfaceSdlGraphicsManager::internUpdateScreen() {
|
||||||
r->h = dst_h * scale1;
|
r->h = dst_h * scale1;
|
||||||
|
|
||||||
#ifdef USE_ASPECT
|
#ifdef USE_ASPECT
|
||||||
if (_videoMode.aspectRatioCorrection && orig_dst_y < height && !_overlayVisible)
|
if (_videoMode.aspectRatioCorrection && orig_dst_y < height && !_overlayInGUI)
|
||||||
r->h = stretch200To240((uint8 *) _hwScreen->pixels, dstPitch, r->w, r->h, r->x, r->y, orig_dst_y * scale1, _videoMode.filtering, convertSDLPixelFormat(_hwScreen->format));
|
r->h = stretch200To240((uint8 *) _hwScreen->pixels, dstPitch, r->w, r->h, r->x, r->y, orig_dst_y * scale1, _videoMode.filtering, convertSDLPixelFormat(_hwScreen->format));
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -1263,7 +1263,7 @@ void SurfaceSdlGraphicsManager::internUpdateScreen() {
|
||||||
// We draw the focus rectangle on top of everything, to assure it's easily visible.
|
// We draw the focus rectangle on top of everything, to assure it's easily visible.
|
||||||
// Of course when the overlay is visible we do not show it, since it is only for game
|
// Of course when the overlay is visible we do not show it, since it is only for game
|
||||||
// specific focus.
|
// specific focus.
|
||||||
if (_enableFocusRect && !_overlayVisible) {
|
if (_enableFocusRect && !_overlayInGUI) {
|
||||||
int x = _focusRect.left + _currentShakeXOffset;
|
int x = _focusRect.left + _currentShakeXOffset;
|
||||||
int y = _focusRect.top + _currentShakeYOffset;
|
int y = _focusRect.top + _currentShakeYOffset;
|
||||||
|
|
||||||
|
@ -1281,7 +1281,7 @@ void SurfaceSdlGraphicsManager::internUpdateScreen() {
|
||||||
w *= scale1;
|
w *= scale1;
|
||||||
h *= scale1;
|
h *= scale1;
|
||||||
|
|
||||||
if (_videoMode.aspectRatioCorrection && !_overlayVisible)
|
if (_videoMode.aspectRatioCorrection && !_overlayInGUI)
|
||||||
y = real2Aspect(y);
|
y = real2Aspect(y);
|
||||||
|
|
||||||
if (h > 0 && w > 0) {
|
if (h > 0 && w > 0) {
|
||||||
|
@ -1437,7 +1437,7 @@ void SurfaceSdlGraphicsManager::copyRectToScreen(const void *buf, int pitch, int
|
||||||
assert(h > 0 && y + h <= _videoMode.screenHeight);
|
assert(h > 0 && y + h <= _videoMode.screenHeight);
|
||||||
assert(w > 0 && x + w <= _videoMode.screenWidth);
|
assert(w > 0 && x + w <= _videoMode.screenWidth);
|
||||||
|
|
||||||
addDirtyRect(x, y, w, h);
|
addDirtyRect(x, y, w, h, false);
|
||||||
|
|
||||||
// Try to lock the screen surface
|
// Try to lock the screen surface
|
||||||
if (SDL_LockSurface(_screen) == -1)
|
if (SDL_LockSurface(_screen) == -1)
|
||||||
|
@ -1502,7 +1502,7 @@ void SurfaceSdlGraphicsManager::fillScreen(uint32 col) {
|
||||||
unlockScreen();
|
unlockScreen();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SurfaceSdlGraphicsManager::addDirtyRect(int x, int y, int w, int h, bool realCoordinates) {
|
void SurfaceSdlGraphicsManager::addDirtyRect(int x, int y, int w, int h, bool inOverlay, bool realCoordinates) {
|
||||||
if (_forceRedraw)
|
if (_forceRedraw)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -1513,7 +1513,7 @@ void SurfaceSdlGraphicsManager::addDirtyRect(int x, int y, int w, int h, bool re
|
||||||
|
|
||||||
int height, width;
|
int height, width;
|
||||||
|
|
||||||
if (!_overlayVisible && !realCoordinates) {
|
if (!inOverlay && !realCoordinates) {
|
||||||
width = _videoMode.screenWidth;
|
width = _videoMode.screenWidth;
|
||||||
height = _videoMode.screenHeight;
|
height = _videoMode.screenHeight;
|
||||||
} else {
|
} else {
|
||||||
|
@ -1552,7 +1552,7 @@ void SurfaceSdlGraphicsManager::addDirtyRect(int x, int y, int w, int h, bool re
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef USE_ASPECT
|
#ifdef USE_ASPECT
|
||||||
if (_videoMode.aspectRatioCorrection && !_overlayVisible && !realCoordinates)
|
if (_videoMode.aspectRatioCorrection && !_overlayInGUI && !realCoordinates)
|
||||||
makeRectStretchable(x, y, w, h, _videoMode.filtering);
|
makeRectStretchable(x, y, w, h, _videoMode.filtering);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -1662,7 +1662,7 @@ void SurfaceSdlGraphicsManager::setFocusRectangle(const Common::Rect &rect) {
|
||||||
|
|
||||||
// We just fake this as a dirty rect for now, to easily force an screen update whenever
|
// We just fake this as a dirty rect for now, to easily force an screen update whenever
|
||||||
// the rect changes.
|
// the rect changes.
|
||||||
addDirtyRect(_focusRect.left, _focusRect.top, _focusRect.width(), _focusRect.height());
|
addDirtyRect(_focusRect.left, _focusRect.top, _focusRect.width(), _focusRect.height(), _overlayVisible);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1676,7 +1676,7 @@ void SurfaceSdlGraphicsManager::clearFocusRectangle() {
|
||||||
|
|
||||||
// We just fake this as a dirty rect for now, to easily force an screen update whenever
|
// We just fake this as a dirty rect for now, to easily force an screen update whenever
|
||||||
// the rect changes.
|
// the rect changes.
|
||||||
addDirtyRect(_focusRect.left, _focusRect.top, _focusRect.width(), _focusRect.height());
|
addDirtyRect(_focusRect.left, _focusRect.top, _focusRect.width(), _focusRect.height(), _overlayVisible);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1771,7 +1771,7 @@ void SurfaceSdlGraphicsManager::copyRectToOverlay(const void *buf, int pitch, in
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// Mark the modified region as dirty
|
// Mark the modified region as dirty
|
||||||
addDirtyRect(x, y, w, h);
|
addDirtyRect(x, y, w, h, true);
|
||||||
|
|
||||||
if (SDL_LockSurface(_overlayscreen) == -1)
|
if (SDL_LockSurface(_overlayscreen) == -1)
|
||||||
error("SDL_LockSurface failed: %s", SDL_GetError());
|
error("SDL_LockSurface failed: %s", SDL_GetError());
|
||||||
|
@ -2106,11 +2106,11 @@ void SurfaceSdlGraphicsManager::undrawMouse() {
|
||||||
|
|
||||||
// When we switch bigger overlay off mouse jumps. Argh!
|
// When we switch bigger overlay off mouse jumps. Argh!
|
||||||
// This is intended to prevent undrawing offscreen mouse
|
// This is intended to prevent undrawing offscreen mouse
|
||||||
if (!_overlayVisible && (x >= _videoMode.screenWidth || y >= _videoMode.screenHeight))
|
if (!_overlayInGUI && (x >= _videoMode.screenWidth || y >= _videoMode.screenHeight))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (_mouseBackup.w != 0 && _mouseBackup.h != 0)
|
if (_mouseBackup.w != 0 && _mouseBackup.h != 0)
|
||||||
addDirtyRect(x, y, _mouseBackup.w, _mouseBackup.h);
|
addDirtyRect(x, y, _mouseBackup.w, _mouseBackup.h, _overlayInGUI);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SurfaceSdlGraphicsManager::drawMouse() {
|
void SurfaceSdlGraphicsManager::drawMouse() {
|
||||||
|
@ -2128,7 +2128,7 @@ void SurfaceSdlGraphicsManager::drawMouse() {
|
||||||
dst.x = virtualCursor.x;
|
dst.x = virtualCursor.x;
|
||||||
dst.y = virtualCursor.y;
|
dst.y = virtualCursor.y;
|
||||||
|
|
||||||
if (!_overlayVisible) {
|
if (!_overlayInGUI) {
|
||||||
scale = _videoMode.scaleFactor;
|
scale = _videoMode.scaleFactor;
|
||||||
dst.w = _mouseCurState.vW;
|
dst.w = _mouseCurState.vW;
|
||||||
dst.h = _mouseCurState.vH;
|
dst.h = _mouseCurState.vH;
|
||||||
|
@ -2161,7 +2161,7 @@ void SurfaceSdlGraphicsManager::drawMouse() {
|
||||||
dst.x += _currentShakeXOffset;
|
dst.x += _currentShakeXOffset;
|
||||||
dst.y += _currentShakeYOffset;
|
dst.y += _currentShakeYOffset;
|
||||||
|
|
||||||
if (_videoMode.aspectRatioCorrection && !_overlayVisible)
|
if (_videoMode.aspectRatioCorrection && !_overlayInGUI)
|
||||||
dst.y = real2Aspect(dst.y);
|
dst.y = real2Aspect(dst.y);
|
||||||
|
|
||||||
dst.x = scale * dst.x - _mouseCurState.rHotX;
|
dst.x = scale * dst.x - _mouseCurState.rHotX;
|
||||||
|
@ -2178,7 +2178,7 @@ void SurfaceSdlGraphicsManager::drawMouse() {
|
||||||
// The screen will be updated using real surface coordinates, i.e.
|
// The screen will be updated using real surface coordinates, i.e.
|
||||||
// they will not be scaled or aspect-ratio corrected.
|
// they will not be scaled or aspect-ratio corrected.
|
||||||
|
|
||||||
addDirtyRect(dst.x, dst.y, dst.w, dst.h, true);
|
addDirtyRect(dst.x, dst.y, dst.w, dst.h, _overlayInGUI, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
#pragma mark -
|
#pragma mark -
|
||||||
|
@ -2643,10 +2643,12 @@ void SurfaceSdlGraphicsManager::SDL_UpdateRects(SDL_Surface *screen, int numrect
|
||||||
SDL_UpdateTexture(_screenTexture, nullptr, screen->pixels, screen->pitch);
|
SDL_UpdateTexture(_screenTexture, nullptr, screen->pixels, screen->pitch);
|
||||||
|
|
||||||
SDL_Rect viewport;
|
SDL_Rect viewport;
|
||||||
viewport.x = _activeArea.drawRect.left;
|
|
||||||
viewport.y = _activeArea.drawRect.top;
|
Common::Rect &drawRect = (_overlayVisible) ? _overlayDrawRect : _gameDrawRect;
|
||||||
viewport.w = _activeArea.drawRect.width();
|
viewport.x = drawRect.left;
|
||||||
viewport.h = _activeArea.drawRect.height();
|
viewport.y = drawRect.top;
|
||||||
|
viewport.w = drawRect.width();
|
||||||
|
viewport.h = drawRect.height();
|
||||||
|
|
||||||
SDL_RenderClear(_renderer);
|
SDL_RenderClear(_renderer);
|
||||||
SDL_RenderCopy(_renderer, _screenTexture, nullptr, &viewport);
|
SDL_RenderCopy(_renderer, _screenTexture, nullptr, &viewport);
|
||||||
|
|
|
@ -403,7 +403,7 @@ protected:
|
||||||
Common::Rect _focusRect;
|
Common::Rect _focusRect;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
virtual void addDirtyRect(int x, int y, int w, int h, bool realCoordinates = false);
|
virtual void addDirtyRect(int x, int y, int w, int h, bool inOverlay, bool realCoordinates = false);
|
||||||
|
|
||||||
virtual void drawMouse();
|
virtual void drawMouse();
|
||||||
virtual void undrawMouse();
|
virtual void undrawMouse();
|
||||||
|
|
|
@ -44,6 +44,7 @@ public:
|
||||||
_windowWidth(0),
|
_windowWidth(0),
|
||||||
_windowHeight(0),
|
_windowHeight(0),
|
||||||
_overlayVisible(false),
|
_overlayVisible(false),
|
||||||
|
_overlayInGUI(false),
|
||||||
_gameScreenShakeXOffset(0),
|
_gameScreenShakeXOffset(0),
|
||||||
_gameScreenShakeYOffset(0),
|
_gameScreenShakeYOffset(0),
|
||||||
_forceRedraw(false),
|
_forceRedraw(false),
|
||||||
|
@ -53,13 +54,22 @@ public:
|
||||||
_cursorNeedsRedraw(false),
|
_cursorNeedsRedraw(false),
|
||||||
_cursorLastInActiveArea(true) {}
|
_cursorLastInActiveArea(true) {}
|
||||||
|
|
||||||
void showOverlay() override {
|
void showOverlay(bool inGUI) override {
|
||||||
|
_overlayInGUI = inGUI;
|
||||||
|
|
||||||
|
if (inGUI) {
|
||||||
|
_activeArea.drawRect = _overlayDrawRect;
|
||||||
|
_activeArea.width = getOverlayWidth();
|
||||||
|
_activeArea.height = getOverlayHeight();
|
||||||
|
} else {
|
||||||
|
_activeArea.drawRect = _gameDrawRect;
|
||||||
|
_activeArea.width = getWidth();
|
||||||
|
_activeArea.height = getHeight();
|
||||||
|
}
|
||||||
|
|
||||||
if (_overlayVisible)
|
if (_overlayVisible)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
_activeArea.drawRect = _overlayDrawRect;
|
|
||||||
_activeArea.width = getOverlayWidth();
|
|
||||||
_activeArea.height = getOverlayHeight();
|
|
||||||
_overlayVisible = true;
|
_overlayVisible = true;
|
||||||
_forceRedraw = true;
|
_forceRedraw = true;
|
||||||
notifyActiveAreaChanged();
|
notifyActiveAreaChanged();
|
||||||
|
@ -69,6 +79,8 @@ public:
|
||||||
if (!_overlayVisible)
|
if (!_overlayVisible)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
_overlayInGUI = true;
|
||||||
|
|
||||||
_activeArea.drawRect = _gameDrawRect;
|
_activeArea.drawRect = _gameDrawRect;
|
||||||
_activeArea.width = getWidth();
|
_activeArea.width = getWidth();
|
||||||
_activeArea.height = getHeight();
|
_activeArea.height = getHeight();
|
||||||
|
@ -203,7 +215,7 @@ protected:
|
||||||
populateDisplayAreaDrawRect(overlayAspect, getOverlayWidth(), getOverlayHeight(), _overlayDrawRect);
|
populateDisplayAreaDrawRect(overlayAspect, getOverlayWidth(), getOverlayHeight(), _overlayDrawRect);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_overlayVisible) {
|
if (_overlayInGUI) {
|
||||||
_activeArea.drawRect = _overlayDrawRect;
|
_activeArea.drawRect = _overlayDrawRect;
|
||||||
_activeArea.width = getOverlayWidth();
|
_activeArea.width = getOverlayWidth();
|
||||||
_activeArea.height = getOverlayHeight();
|
_activeArea.height = getOverlayHeight();
|
||||||
|
@ -296,6 +308,11 @@ protected:
|
||||||
*/
|
*/
|
||||||
bool _overlayVisible;
|
bool _overlayVisible;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Whether when overlay is shown, mouse coordinates depend on window or game screen size
|
||||||
|
*/
|
||||||
|
bool _overlayInGUI;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The offset by which the screen is moved horizontally.
|
* The offset by which the screen is moved horizontally.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -322,7 +322,8 @@ void AndroidGraphics3dManager::updateScreen() {
|
||||||
_game_texture->drawTextureRect();
|
_game_texture->drawTextureRect();
|
||||||
|
|
||||||
if (_show_overlay) {
|
if (_show_overlay) {
|
||||||
if (_overlay_background && _overlay_background->getTextureName() != 0) {
|
// If the overlay is in game we expect the game to continue drawing
|
||||||
|
if (_overlay_in_gui && _overlay_background && _overlay_background->getTextureName() != 0) {
|
||||||
GLCALL(_overlay_background->drawTextureRect());
|
GLCALL(_overlay_background->drawTextureRect());
|
||||||
}
|
}
|
||||||
GLCALL(_overlay_texture->drawTextureRect());
|
GLCALL(_overlay_texture->drawTextureRect());
|
||||||
|
@ -491,18 +492,24 @@ bool AndroidGraphics3dManager::getFeatureState(OSystem::Feature f) const {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void AndroidGraphics3dManager::showOverlay() {
|
void AndroidGraphics3dManager::showOverlay(bool inGUI) {
|
||||||
ENTER();
|
ENTER();
|
||||||
|
|
||||||
if (_show_overlay) {
|
if (_show_overlay && inGUI == _overlay_in_gui) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
_old_touch_mode = JNI::getTouchMode();
|
if (inGUI) {
|
||||||
// in 3D, in overlay
|
_old_touch_mode = JNI::getTouchMode();
|
||||||
dynamic_cast<OSystem_Android *>(g_system)->applyTouchSettings(true, true);
|
// in 3D, in overlay
|
||||||
|
dynamic_cast<OSystem_Android *>(g_system)->applyTouchSettings(true, true);
|
||||||
|
} else if (_overlay_in_gui) {
|
||||||
|
// Restore touch mode active before overlay was shown
|
||||||
|
JNI::setTouchMode(_old_touch_mode);
|
||||||
|
}
|
||||||
|
|
||||||
_show_overlay = true;
|
_show_overlay = true;
|
||||||
|
_overlay_in_gui = inGUI;
|
||||||
_force_redraw = true;
|
_force_redraw = true;
|
||||||
|
|
||||||
// If there is a game running capture the screen, so that it can be shown "below" the overlay.
|
// If there is a game running capture the screen, so that it can be shown "below" the overlay.
|
||||||
|
@ -546,10 +553,14 @@ void AndroidGraphics3dManager::hideOverlay() {
|
||||||
|
|
||||||
_overlay_background->release();
|
_overlay_background->release();
|
||||||
|
|
||||||
// Restore touch mode active before overlay was shown
|
if (_overlay_in_gui) {
|
||||||
JNI::setTouchMode(_old_touch_mode);
|
// Restore touch mode active before overlay was shown
|
||||||
|
JNI::setTouchMode(_old_touch_mode);
|
||||||
|
|
||||||
warpMouse(_game_texture->width() / 2, _game_texture->height() / 2);
|
warpMouse(_game_texture->width() / 2, _game_texture->height() / 2);
|
||||||
|
}
|
||||||
|
|
||||||
|
_overlay_in_gui = false;
|
||||||
|
|
||||||
// double buffered, flip twice
|
// double buffered, flip twice
|
||||||
clearScreen(kClearUpdate, 2);
|
clearScreen(kClearUpdate, 2);
|
||||||
|
|
|
@ -70,7 +70,7 @@ public:
|
||||||
virtual void setFeatureState(OSystem::Feature f, bool enable) override;
|
virtual void setFeatureState(OSystem::Feature f, bool enable) override;
|
||||||
virtual bool getFeatureState(OSystem::Feature f) const override;
|
virtual bool getFeatureState(OSystem::Feature f) const override;
|
||||||
|
|
||||||
virtual void showOverlay() override;
|
virtual void showOverlay(bool inGUI) override;
|
||||||
virtual void hideOverlay() override;
|
virtual void hideOverlay() override;
|
||||||
virtual void clearOverlay() override;
|
virtual void clearOverlay() override;
|
||||||
virtual void grabOverlay(Graphics::Surface &surface) const override;
|
virtual void grabOverlay(Graphics::Surface &surface) const override;
|
||||||
|
@ -172,6 +172,7 @@ private:
|
||||||
GLESTexture *_overlay_background;
|
GLESTexture *_overlay_background;
|
||||||
GLESTexture *_overlay_texture;
|
GLESTexture *_overlay_texture;
|
||||||
bool _show_overlay;
|
bool _show_overlay;
|
||||||
|
bool _overlay_in_gui;
|
||||||
|
|
||||||
// Mouse layer
|
// Mouse layer
|
||||||
GLESBaseTexture *_mouse_texture;
|
GLESBaseTexture *_mouse_texture;
|
||||||
|
|
|
@ -649,7 +649,8 @@ void OpenGLSdlGraphics3dManager::updateScreen() {
|
||||||
if (_overlayVisible) {
|
if (_overlayVisible) {
|
||||||
_overlayScreen->update();
|
_overlayScreen->update();
|
||||||
|
|
||||||
if (_overlayBackground) {
|
// If the overlay is in game we expect the game to continue calling OpenGL
|
||||||
|
if (_overlayBackground && _overlayInGUI) {
|
||||||
_overlayBackground->update();
|
_overlayBackground->update();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -685,11 +686,12 @@ int16 OpenGLSdlGraphics3dManager::getWidth() const {
|
||||||
#pragma mark --- Overlays ---
|
#pragma mark --- Overlays ---
|
||||||
#pragma mark -
|
#pragma mark -
|
||||||
|
|
||||||
void OpenGLSdlGraphics3dManager::showOverlay() {
|
void OpenGLSdlGraphics3dManager::showOverlay(bool inGUI) {
|
||||||
if (_overlayVisible) {
|
if (_overlayVisible && _overlayInGUI == inGUI) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
WindowedGraphicsManager::showOverlay();
|
|
||||||
|
WindowedGraphicsManager::showOverlay(inGUI);
|
||||||
|
|
||||||
delete _overlayBackground;
|
delete _overlayBackground;
|
||||||
_overlayBackground = nullptr;
|
_overlayBackground = nullptr;
|
||||||
|
|
|
@ -92,7 +92,7 @@ public:
|
||||||
void clearFocusRectangle() override {}
|
void clearFocusRectangle() override {}
|
||||||
|
|
||||||
// GraphicsManager API - Overlay
|
// GraphicsManager API - Overlay
|
||||||
void showOverlay() override;
|
void showOverlay(bool inGUI) override;
|
||||||
void hideOverlay() override;
|
void hideOverlay() override;
|
||||||
Graphics::PixelFormat getOverlayFormat() const override { return _overlayFormat; }
|
Graphics::PixelFormat getOverlayFormat() const override { return _overlayFormat; }
|
||||||
void clearOverlay() override;
|
void clearOverlay() override;
|
||||||
|
|
|
@ -198,8 +198,8 @@ void ModularGraphicsBackend::clearFocusRectangle() {
|
||||||
_graphicsManager->clearFocusRectangle();
|
_graphicsManager->clearFocusRectangle();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ModularGraphicsBackend::showOverlay() {
|
void ModularGraphicsBackend::showOverlay(bool inGUI) {
|
||||||
_graphicsManager->showOverlay();
|
_graphicsManager->showOverlay(inGUI);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ModularGraphicsBackend::hideOverlay() {
|
void ModularGraphicsBackend::hideOverlay() {
|
||||||
|
|
|
@ -101,7 +101,7 @@ public:
|
||||||
void setFocusRectangle(const Common::Rect& rect) override final;
|
void setFocusRectangle(const Common::Rect& rect) override final;
|
||||||
void clearFocusRectangle() override final;
|
void clearFocusRectangle() override final;
|
||||||
|
|
||||||
void showOverlay() override final;
|
void showOverlay(bool inGUI) override final;
|
||||||
void hideOverlay() override final;
|
void hideOverlay() override final;
|
||||||
bool isOverlayVisible() const override final;
|
bool isOverlayVisible() const override final;
|
||||||
Graphics::PixelFormat getOverlayFormat() const override final;
|
Graphics::PixelFormat getOverlayFormat() const override final;
|
||||||
|
|
|
@ -277,7 +277,7 @@ void OSystem_3DS::destroyEvents() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void OSystem_3DS::transformPoint(touchPosition &point) {
|
void OSystem_3DS::transformPoint(touchPosition &point) {
|
||||||
if (!_overlayVisible) {
|
if (!_overlayInGUI) {
|
||||||
point.px = static_cast<float>(point.px) / _gameBottomTexture.getScaleX() - _gameBottomTexture.getPosX();
|
point.px = static_cast<float>(point.px) / _gameBottomTexture.getScaleX() - _gameBottomTexture.getPosX();
|
||||||
point.py = static_cast<float>(point.py) / _gameBottomTexture.getScaleY() - _gameBottomTexture.getPosY();
|
point.py = static_cast<float>(point.py) / _gameBottomTexture.getScaleY() - _gameBottomTexture.getPosY();
|
||||||
}
|
}
|
||||||
|
@ -286,7 +286,7 @@ void OSystem_3DS::transformPoint(touchPosition &point) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void OSystem_3DS::clipPoint(touchPosition &point) {
|
void OSystem_3DS::clipPoint(touchPosition &point) {
|
||||||
if (_overlayVisible) {
|
if (_overlayInGUI) {
|
||||||
point.px = CLIP<uint16>(point.px, 0, getOverlayWidth() - 1);
|
point.px = CLIP<uint16>(point.px, 0, getOverlayWidth() - 1);
|
||||||
point.py = CLIP<uint16>(point.py, 0, getOverlayHeight() - 1);
|
point.py = CLIP<uint16>(point.py, 0, getOverlayHeight() - 1);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -263,7 +263,7 @@ void OSystem_3DS::updateSize() {
|
||||||
_gameBottomTexture.setPosition(_gameBottomX, _gameBottomY);
|
_gameBottomTexture.setPosition(_gameBottomX, _gameBottomY);
|
||||||
_gameTopTexture.setOffset(0, 0);
|
_gameTopTexture.setOffset(0, 0);
|
||||||
_gameBottomTexture.setOffset(0, 0);
|
_gameBottomTexture.setOffset(0, 0);
|
||||||
if (_overlayVisible) {
|
if (_overlayInGUI) {
|
||||||
_cursorTexture.setScale(1.f, 1.f);
|
_cursorTexture.setScale(1.f, 1.f);
|
||||||
} else if (config.screen == kScreenTop) {
|
} else if (config.screen == kScreenTop) {
|
||||||
_cursorTexture.setScale(_gameTopTexture.getScaleX(), _gameTopTexture.getScaleY());
|
_cursorTexture.setScale(_gameTopTexture.getScaleX(), _gameTopTexture.getScaleY());
|
||||||
|
@ -329,7 +329,7 @@ OSystem::TransactionError OSystem_3DS::endGFXTransaction() {
|
||||||
}
|
}
|
||||||
|
|
||||||
float OSystem_3DS::getScaleRatio() const {
|
float OSystem_3DS::getScaleRatio() const {
|
||||||
if (_overlayVisible) {
|
if (_overlayInGUI) {
|
||||||
return 1.0;
|
return 1.0;
|
||||||
} else if (config.screen == kScreenTop) {
|
} else if (config.screen == kScreenTop) {
|
||||||
return _gameTopTexture.getScaleX();
|
return _gameTopTexture.getScaleX();
|
||||||
|
@ -457,7 +457,7 @@ void OSystem_3DS::updateScreen() {
|
||||||
}
|
}
|
||||||
if (_cursorVisible && config.showCursor && config.screen == kScreenTop) {
|
if (_cursorVisible && config.showCursor && config.screen == kScreenTop) {
|
||||||
C3D_FVUnifMtx4x4(GPU_VERTEX_SHADER, _modelviewLocation, _cursorTexture.getMatrix());
|
C3D_FVUnifMtx4x4(GPU_VERTEX_SHADER, _modelviewLocation, _cursorTexture.getMatrix());
|
||||||
_cursorTexture.setFilteringMode(!_overlayVisible && _filteringEnabled);
|
_cursorTexture.setFilteringMode(!_overlayInGUI && _filteringEnabled);
|
||||||
_cursorTexture.render();
|
_cursorTexture.render();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -486,7 +486,7 @@ void OSystem_3DS::updateScreen() {
|
||||||
}
|
}
|
||||||
if (_cursorVisible && config.showCursor) {
|
if (_cursorVisible && config.showCursor) {
|
||||||
C3D_FVUnifMtx4x4(GPU_VERTEX_SHADER, _modelviewLocation, _cursorTexture.getMatrix());
|
C3D_FVUnifMtx4x4(GPU_VERTEX_SHADER, _modelviewLocation, _cursorTexture.getMatrix());
|
||||||
_cursorTexture.setFilteringMode(!_overlayVisible && _filteringEnabled);
|
_cursorTexture.setFilteringMode(!_overlayInGUI && _filteringEnabled);
|
||||||
_cursorTexture.render();
|
_cursorTexture.render();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -609,13 +609,15 @@ void OSystem_3DS::updateMagnify() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void OSystem_3DS::showOverlay() {
|
void OSystem_3DS::showOverlay(bool inGUI) {
|
||||||
|
_overlayInGUI = inGUI;
|
||||||
_overlayVisible = true;
|
_overlayVisible = true;
|
||||||
updateSize();
|
updateSize();
|
||||||
}
|
}
|
||||||
|
|
||||||
void OSystem_3DS::hideOverlay() {
|
void OSystem_3DS::hideOverlay() {
|
||||||
_overlayVisible = false;
|
_overlayVisible = false;
|
||||||
|
_overlayInGUI = false;
|
||||||
updateSize();
|
updateSize();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -81,6 +81,7 @@ OSystem_3DS::OSystem_3DS():
|
||||||
_gameTextureDirty(false),
|
_gameTextureDirty(false),
|
||||||
_filteringEnabled(true),
|
_filteringEnabled(true),
|
||||||
_overlayVisible(false),
|
_overlayVisible(false),
|
||||||
|
_overlayInGUI(false),
|
||||||
_screenChangeId(0),
|
_screenChangeId(0),
|
||||||
_magnifyMode(MODE_MAGOFF),
|
_magnifyMode(MODE_MAGOFF),
|
||||||
exiting(false),
|
exiting(false),
|
||||||
|
|
|
@ -153,7 +153,7 @@ public:
|
||||||
void setShakePos(int shakeXOffset, int shakeYOffset);
|
void setShakePos(int shakeXOffset, int shakeYOffset);
|
||||||
void setFocusRectangle(const Common::Rect &rect);
|
void setFocusRectangle(const Common::Rect &rect);
|
||||||
void clearFocusRectangle();
|
void clearFocusRectangle();
|
||||||
void showOverlay();
|
void showOverlay(bool inGUI);
|
||||||
void hideOverlay();
|
void hideOverlay();
|
||||||
bool isOverlayVisible() const { return _overlayVisible; }
|
bool isOverlayVisible() const { return _overlayVisible; }
|
||||||
Graphics::PixelFormat getOverlayFormat() const;
|
Graphics::PixelFormat getOverlayFormat() const;
|
||||||
|
@ -241,6 +241,7 @@ private:
|
||||||
int _screenShakeXOffset;
|
int _screenShakeXOffset;
|
||||||
int _screenShakeYOffset;
|
int _screenShakeYOffset;
|
||||||
bool _overlayVisible;
|
bool _overlayVisible;
|
||||||
|
bool _overlayInGUI;
|
||||||
int _screenChangeId;
|
int _screenChangeId;
|
||||||
|
|
||||||
DVLB_s *_dvlb;
|
DVLB_s *_dvlb;
|
||||||
|
|
|
@ -154,7 +154,7 @@ public:
|
||||||
int16 getOverlayHeight();
|
int16 getOverlayHeight();
|
||||||
int16 getOverlayWidth();
|
int16 getOverlayWidth();
|
||||||
bool isOverlayVisible() const { return _overlay_visible; }
|
bool isOverlayVisible() const { return _overlay_visible; }
|
||||||
void showOverlay();
|
void showOverlay(bool inGUI);
|
||||||
void hideOverlay();
|
void hideOverlay();
|
||||||
void clearOverlay();
|
void clearOverlay();
|
||||||
void grabOverlay(Graphics::Surface &surface);
|
void grabOverlay(Graphics::Surface &surface);
|
||||||
|
@ -193,6 +193,7 @@ public:
|
||||||
bool _overlay_visible, _overlay_dirty, _screen_dirty;
|
bool _overlay_visible, _overlay_dirty, _screen_dirty;
|
||||||
int _screen_buffer, _overlay_buffer, _mouse_buffer;
|
int _screen_buffer, _overlay_buffer, _mouse_buffer;
|
||||||
bool _aspect_stretch, _softkbd_on, _enable_cursor_palette;
|
bool _aspect_stretch, _softkbd_on, _enable_cursor_palette;
|
||||||
|
bool _overlay_in_gui;
|
||||||
float _overlay_fade, _xscale, _yscale, _top_offset;
|
float _overlay_fade, _xscale, _yscale, _top_offset;
|
||||||
int _softkbd_motion;
|
int _softkbd_motion;
|
||||||
|
|
||||||
|
|
|
@ -45,7 +45,7 @@ OSystem_Dreamcast::OSystem_Dreamcast()
|
||||||
: _devpoll(0), screen(NULL), mouse(NULL), overlay(NULL), _softkbd(this),
|
: _devpoll(0), screen(NULL), mouse(NULL), overlay(NULL), _softkbd(this),
|
||||||
_ms_buf(NULL), _mixer(NULL),
|
_ms_buf(NULL), _mixer(NULL),
|
||||||
_current_shake_x_pos(0), _current_shake_y_pos(0), _aspect_stretch(false), _softkbd_on(false),
|
_current_shake_x_pos(0), _current_shake_y_pos(0), _aspect_stretch(false), _softkbd_on(false),
|
||||||
_softkbd_motion(0), _enable_cursor_palette(false), _screenFormat(0)
|
_softkbd_motion(0), _enable_cursor_palette(false), _overlay_in_gui(false), _screenFormat(0)
|
||||||
{
|
{
|
||||||
memset(screen_tx, 0, sizeof(screen_tx));
|
memset(screen_tx, 0, sizeof(screen_tx));
|
||||||
memset(mouse_tx, 0, sizeof(mouse_tx));
|
memset(mouse_tx, 0, sizeof(mouse_tx));
|
||||||
|
|
|
@ -634,14 +634,16 @@ void OSystem_Dreamcast::mouseToSoftKbd(int x, int y, int &rx, int &ry) const
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void OSystem_Dreamcast::showOverlay()
|
void OSystem_Dreamcast::showOverlay(bool inGUI)
|
||||||
{
|
{
|
||||||
|
_overlay_in_gui = inGUI;
|
||||||
_overlay_visible = true;
|
_overlay_visible = true;
|
||||||
clearOverlay();
|
clearOverlay();
|
||||||
}
|
}
|
||||||
|
|
||||||
void OSystem_Dreamcast::hideOverlay()
|
void OSystem_Dreamcast::hideOverlay()
|
||||||
{
|
{
|
||||||
|
_overlay_in_gui = false;
|
||||||
_overlay_visible = false;
|
_overlay_visible = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -215,7 +215,7 @@ bool OSystem_Dreamcast::pollEvent(Common::Event &event)
|
||||||
if (_ms_cur_y>=_screen_h) _ms_cur_y=_screen_h-1;
|
if (_ms_cur_y>=_screen_h) _ms_cur_y=_screen_h-1;
|
||||||
event.mouse.x = _ms_cur_x;
|
event.mouse.x = _ms_cur_x;
|
||||||
event.mouse.y = _ms_cur_y;
|
event.mouse.y = _ms_cur_y;
|
||||||
if (_overlay_visible) {
|
if (_overlay_in_gui) {
|
||||||
event.mouse.x -= _overlay_x;
|
event.mouse.x -= _overlay_x;
|
||||||
event.mouse.y -= _overlay_y;
|
event.mouse.y -= _overlay_y;
|
||||||
}
|
}
|
||||||
|
|
|
@ -408,7 +408,9 @@ void OSystem_DS::updateScreen() {
|
||||||
|
|
||||||
if (_overlay.isVisible()) {
|
if (_overlay.isVisible()) {
|
||||||
_overlay.update();
|
_overlay.update();
|
||||||
} else {
|
}
|
||||||
|
|
||||||
|
if (_framebuffer.isVisible()) {
|
||||||
if (_paletteDirty) {
|
if (_paletteDirty) {
|
||||||
dmaCopyHalfWords(3, _palette, BG_PALETTE, 256 * 2);
|
dmaCopyHalfWords(3, _palette, BG_PALETTE, 256 * 2);
|
||||||
#ifdef DISABLE_TEXT_CONSOLE
|
#ifdef DISABLE_TEXT_CONSOLE
|
||||||
|
@ -430,12 +432,14 @@ void OSystem_DS::setShakePos(int shakeXOffset, int shakeYOffset) {
|
||||||
DS::setShakePos(shakeXOffset, shakeYOffset);
|
DS::setShakePos(shakeXOffset, shakeYOffset);
|
||||||
}
|
}
|
||||||
|
|
||||||
void OSystem_DS::showOverlay() {
|
void OSystem_DS::showOverlay(bool inGUI) {
|
||||||
|
_overlayInGUI = inGUI;
|
||||||
_overlay.reset();
|
_overlay.reset();
|
||||||
_overlay.show();
|
_overlay.show();
|
||||||
}
|
}
|
||||||
|
|
||||||
void OSystem_DS::hideOverlay() {
|
void OSystem_DS::hideOverlay() {
|
||||||
|
_overlayInGUI = false;
|
||||||
_overlay.hide();
|
_overlay.hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -471,7 +475,7 @@ Graphics::PixelFormat OSystem_DS::getOverlayFormat() const {
|
||||||
}
|
}
|
||||||
|
|
||||||
Common::Point OSystem_DS::transformPoint(int16 x, int16 y) {
|
Common::Point OSystem_DS::transformPoint(int16 x, int16 y) {
|
||||||
if (_overlay.isVisible())
|
if (_overlayInGUI)
|
||||||
return Common::Point(x, y);
|
return Common::Point(x, y);
|
||||||
else
|
else
|
||||||
return _framebuffer.realToScaled(x, y);
|
return _framebuffer.realToScaled(x, y);
|
||||||
|
@ -484,7 +488,7 @@ bool OSystem_DS::showMouse(bool visible) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void OSystem_DS::warpMouse(int x, int y) {
|
void OSystem_DS::warpMouse(int x, int y) {
|
||||||
if (_overlay.isVisible())
|
if (_overlayInGUI)
|
||||||
_cursorPos = Common::Point(x, y);
|
_cursorPos = Common::Point(x, y);
|
||||||
else
|
else
|
||||||
_cursorPos = _framebuffer.scaledToReal(x, y);
|
_cursorPos = _framebuffer.scaledToReal(x, y);
|
||||||
|
|
|
@ -46,7 +46,7 @@ OSystem_DS *OSystem_DS::_instance = NULL;
|
||||||
OSystem_DS::OSystem_DS()
|
OSystem_DS::OSystem_DS()
|
||||||
: _eventSource(NULL), _disableCursorPalette(true),
|
: _eventSource(NULL), _disableCursorPalette(true),
|
||||||
_graphicsMode(GFX_HWSCALE), _stretchMode(100),
|
_graphicsMode(GFX_HWSCALE), _stretchMode(100),
|
||||||
_paletteDirty(false), _cursorDirty(false),
|
_paletteDirty(false), _cursorDirty(false), _overlayInGUI(false),
|
||||||
_pfCLUT8(Graphics::PixelFormat::createFormatCLUT8()),
|
_pfCLUT8(Graphics::PixelFormat::createFormatCLUT8()),
|
||||||
_pfABGR1555(Graphics::PixelFormat(2, 5, 5, 5, 1, 0, 5, 10, 15)),
|
_pfABGR1555(Graphics::PixelFormat(2, 5, 5, 5, 1, 0, 5, 10, 15)),
|
||||||
_callbackTimer(10), _currentTimeMillis(0), _subScreenActive(true)
|
_callbackTimer(10), _currentTimeMillis(0), _subScreenActive(true)
|
||||||
|
|
|
@ -59,6 +59,7 @@ protected:
|
||||||
int _cursorHotY;
|
int _cursorHotY;
|
||||||
uint32 _cursorKey;
|
uint32 _cursorKey;
|
||||||
bool _cursorVisible;
|
bool _cursorVisible;
|
||||||
|
bool _overlayInGUI;
|
||||||
|
|
||||||
DSEventSource *_eventSource;
|
DSEventSource *_eventSource;
|
||||||
DS::Keyboard *_keyboard;
|
DS::Keyboard *_keyboard;
|
||||||
|
@ -107,7 +108,7 @@ public:
|
||||||
virtual void updateScreen();
|
virtual void updateScreen();
|
||||||
virtual void setShakePos(int shakeXOffset, int shakeYOffset);
|
virtual void setShakePos(int shakeXOffset, int shakeYOffset);
|
||||||
|
|
||||||
virtual void showOverlay();
|
virtual void showOverlay(bool inGUI);
|
||||||
virtual void hideOverlay();
|
virtual void hideOverlay();
|
||||||
virtual bool isOverlayVisible() const;
|
virtual bool isOverlayVisible() const;
|
||||||
virtual void clearOverlay();
|
virtual void clearOverlay();
|
||||||
|
|
|
@ -69,7 +69,7 @@ enum UIViewTapDescription {
|
||||||
|
|
||||||
struct VideoContext {
|
struct VideoContext {
|
||||||
VideoContext() : asprectRatioCorrection(), screenWidth(), screenHeight(), overlayVisible(false),
|
VideoContext() : asprectRatioCorrection(), screenWidth(), screenHeight(), overlayVisible(false),
|
||||||
overlayWidth(), overlayHeight(), mouseX(), mouseY(),
|
overlayInGUI(false), overlayWidth(), overlayHeight(), mouseX(), mouseY(),
|
||||||
mouseHotspotX(), mouseHotspotY(), mouseWidth(), mouseHeight(),
|
mouseHotspotX(), mouseHotspotY(), mouseWidth(), mouseHeight(),
|
||||||
mouseIsVisible(), filtering(false), shakeXOffset(), shakeYOffset() {
|
mouseIsVisible(), filtering(false), shakeXOffset(), shakeYOffset() {
|
||||||
}
|
}
|
||||||
|
@ -81,6 +81,7 @@ struct VideoContext {
|
||||||
|
|
||||||
// Overlay state
|
// Overlay state
|
||||||
bool overlayVisible;
|
bool overlayVisible;
|
||||||
|
bool overlayInGUI;
|
||||||
uint overlayWidth, overlayHeight;
|
uint overlayWidth, overlayHeight;
|
||||||
Graphics::Surface overlayTexture;
|
Graphics::Surface overlayTexture;
|
||||||
|
|
||||||
|
|
|
@ -230,7 +230,7 @@ bool OSystem_iOS7::handleEvent_secondMouseUp(Common::Event &event, int x, int y)
|
||||||
|
|
||||||
if (curTime - _lastSecondaryDown < 400) {
|
if (curTime - _lastSecondaryDown < 400) {
|
||||||
//printf("Right tap!\n");
|
//printf("Right tap!\n");
|
||||||
if (curTime - _lastSecondaryTap < 400 && !_videoContext->overlayVisible) {
|
if (curTime - _lastSecondaryTap < 400 && !_videoContext->overlayInGUI) {
|
||||||
//printf("Right escape!\n");
|
//printf("Right escape!\n");
|
||||||
event.type = Common::EVENT_KEYDOWN;
|
event.type = Common::EVENT_KEYDOWN;
|
||||||
_queuedInputEvent.type = Common::EVENT_KEYUP;
|
_queuedInputEvent.type = Common::EVENT_KEYUP;
|
||||||
|
@ -283,8 +283,8 @@ bool OSystem_iOS7::handleEvent_mouseDragged(Common::Event &event, int x, int y)
|
||||||
mouseNewPosX = (int)(_videoContext->mouseX - deltaX / 0.5f);
|
mouseNewPosX = (int)(_videoContext->mouseX - deltaX / 0.5f);
|
||||||
mouseNewPosY = (int)(_videoContext->mouseY - deltaY / 0.5f);
|
mouseNewPosY = (int)(_videoContext->mouseY - deltaY / 0.5f);
|
||||||
|
|
||||||
int widthCap = _videoContext->overlayVisible ? _videoContext->overlayWidth : _videoContext->screenWidth;
|
int widthCap = _videoContext->overlayInGUI ? _videoContext->overlayWidth : _videoContext->screenWidth;
|
||||||
int heightCap = _videoContext->overlayVisible ? _videoContext->overlayHeight : _videoContext->screenHeight;
|
int heightCap = _videoContext->overlayInGUI ? _videoContext->overlayHeight : _videoContext->screenHeight;
|
||||||
|
|
||||||
if (mouseNewPosX < 0)
|
if (mouseNewPosX < 0)
|
||||||
mouseNewPosX = 0;
|
mouseNewPosX = 0;
|
||||||
|
|
|
@ -164,7 +164,7 @@ public:
|
||||||
void unlockScreen() override;
|
void unlockScreen() override;
|
||||||
void setShakePos(int shakeXOffset, int shakeYOffset) override;
|
void setShakePos(int shakeXOffset, int shakeYOffset) override;
|
||||||
|
|
||||||
void showOverlay() override;
|
void showOverlay(bool inGUI) override;
|
||||||
void hideOverlay() override;
|
void hideOverlay() override;
|
||||||
bool isOverlayVisible() const override { return _videoContext->overlayVisible; }
|
bool isOverlayVisible() const override { return _videoContext->overlayVisible; }
|
||||||
void clearOverlay() override;
|
void clearOverlay() override;
|
||||||
|
|
|
@ -355,9 +355,10 @@ void OSystem_iOS7::setShakePos(int shakeXOffset, int shakeYOffset) {
|
||||||
_mouseDirty = true;
|
_mouseDirty = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void OSystem_iOS7::showOverlay() {
|
void OSystem_iOS7::showOverlay(bool inGUI) {
|
||||||
//printf("showOverlay()\n");
|
//printf("showOverlay()\n");
|
||||||
_videoContext->overlayVisible = true;
|
_videoContext->overlayVisible = true;
|
||||||
|
_videoContext->overlayInGUI = inGUI;
|
||||||
dirtyFullOverlayScreen();
|
dirtyFullOverlayScreen();
|
||||||
updateScreen();
|
updateScreen();
|
||||||
execute_on_main_thread(^ {
|
execute_on_main_thread(^ {
|
||||||
|
@ -369,6 +370,7 @@ void OSystem_iOS7::showOverlay() {
|
||||||
void OSystem_iOS7::hideOverlay() {
|
void OSystem_iOS7::hideOverlay() {
|
||||||
//printf("hideOverlay()\n");
|
//printf("hideOverlay()\n");
|
||||||
_videoContext->overlayVisible = false;
|
_videoContext->overlayVisible = false;
|
||||||
|
_videoContext->overlayInGUI = false;
|
||||||
_dirtyOverlayRects.clear();
|
_dirtyOverlayRects.clear();
|
||||||
dirtyFullScreen();
|
dirtyFullScreen();
|
||||||
execute_on_main_thread(^ {
|
execute_on_main_thread(^ {
|
||||||
|
|
|
@ -522,7 +522,7 @@ uint getSizeNextPOT(uint size) {
|
||||||
CGRect *rect;
|
CGRect *rect;
|
||||||
int maxWidth, maxHeight;
|
int maxWidth, maxHeight;
|
||||||
|
|
||||||
if (!_videoContext.overlayVisible) {
|
if (!_videoContext.overlayInGUI) {
|
||||||
rect = &_gameScreenRect;
|
rect = &_gameScreenRect;
|
||||||
maxWidth = _videoContext.screenWidth;
|
maxWidth = _videoContext.screenWidth;
|
||||||
maxHeight = _videoContext.screenHeight;
|
maxHeight = _videoContext.screenHeight;
|
||||||
|
@ -533,7 +533,7 @@ uint getSizeNextPOT(uint size) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!maxWidth || !maxHeight) {
|
if (!maxWidth || !maxHeight) {
|
||||||
printf("WARNING: updateMouseCursorScaling called when screen was not ready (%d)!\n", _videoContext.overlayVisible);
|
printf("WARNING: updateMouseCursorScaling called when screen was not ready (%d)!\n", _videoContext.overlayInGUI);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -787,7 +787,7 @@ uint getSizeNextPOT(uint size) {
|
||||||
|
|
||||||
CGRect *area;
|
CGRect *area;
|
||||||
int width, height, offsetX, offsetY;
|
int width, height, offsetX, offsetY;
|
||||||
if (_videoContext.overlayVisible) {
|
if (_videoContext.overlayInGUI) {
|
||||||
area = &_overlayRect;
|
area = &_overlayRect;
|
||||||
width = _videoContext.overlayWidth;
|
width = _videoContext.overlayWidth;
|
||||||
height = _videoContext.overlayHeight;
|
height = _videoContext.overlayHeight;
|
||||||
|
|
|
@ -53,7 +53,7 @@ enum UIViewSwipeDirection {
|
||||||
|
|
||||||
struct VideoContext {
|
struct VideoContext {
|
||||||
VideoContext() : asprectRatioCorrection(), screenWidth(), screenHeight(), overlayVisible(false),
|
VideoContext() : asprectRatioCorrection(), screenWidth(), screenHeight(), overlayVisible(false),
|
||||||
overlayWidth(), overlayHeight(), mouseX(), mouseY(),
|
overlayInGUI(false), overlayWidth(), overlayHeight(), mouseX(), mouseY(),
|
||||||
mouseHotspotX(), mouseHotspotY(), mouseWidth(), mouseHeight(),
|
mouseHotspotX(), mouseHotspotY(), mouseWidth(), mouseHeight(),
|
||||||
mouseIsVisible(), filtering(false),
|
mouseIsVisible(), filtering(false),
|
||||||
shakeXOffset(), shakeYOffset() {
|
shakeXOffset(), shakeYOffset() {
|
||||||
|
@ -66,6 +66,7 @@ struct VideoContext {
|
||||||
|
|
||||||
// Overlay state
|
// Overlay state
|
||||||
bool overlayVisible;
|
bool overlayVisible;
|
||||||
|
bool overlayInGUI;
|
||||||
uint overlayWidth, overlayHeight;
|
uint overlayWidth, overlayHeight;
|
||||||
Graphics::Surface overlayTexture;
|
Graphics::Surface overlayTexture;
|
||||||
|
|
||||||
|
|
|
@ -318,7 +318,7 @@ const char *iPhone_getDocumentsDir() {
|
||||||
CGRect *rect;
|
CGRect *rect;
|
||||||
int maxWidth, maxHeight;
|
int maxWidth, maxHeight;
|
||||||
|
|
||||||
if (!_videoContext.overlayVisible) {
|
if (!_videoContext.overlayInGUI) {
|
||||||
rect = &_gameScreenRect;
|
rect = &_gameScreenRect;
|
||||||
maxWidth = _videoContext.screenWidth;
|
maxWidth = _videoContext.screenWidth;
|
||||||
maxHeight = _videoContext.screenHeight;
|
maxHeight = _videoContext.screenHeight;
|
||||||
|
@ -329,7 +329,7 @@ const char *iPhone_getDocumentsDir() {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!maxWidth || !maxHeight) {
|
if (!maxWidth || !maxHeight) {
|
||||||
printf("WARNING: updateMouseCursorScaling called when screen was not ready (%d)!\n", _videoContext.overlayVisible);
|
printf("WARNING: updateMouseCursorScaling called when screen was not ready (%d)!\n", _videoContext.overlayInGUI);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -626,7 +626,7 @@ const char *iPhone_getDocumentsDir() {
|
||||||
|
|
||||||
CGRect *area;
|
CGRect *area;
|
||||||
int width, height, offsetX, offsetY;
|
int width, height, offsetX, offsetY;
|
||||||
if (_videoContext.overlayVisible) {
|
if (_videoContext.overlayInGUI) {
|
||||||
area = &_overlayRect;
|
area = &_overlayRect;
|
||||||
width = _videoContext.overlayWidth;
|
width = _videoContext.overlayWidth;
|
||||||
height = _videoContext.overlayHeight;
|
height = _videoContext.overlayHeight;
|
||||||
|
|
|
@ -182,7 +182,7 @@ bool OSystem_IPHONE::handleEvent_secondMouseUp(Common::Event &event, int x, int
|
||||||
|
|
||||||
if (curTime - _lastSecondaryDown < 400) {
|
if (curTime - _lastSecondaryDown < 400) {
|
||||||
//printf("Right tap!\n");
|
//printf("Right tap!\n");
|
||||||
if (curTime - _lastSecondaryTap < 400 && !_videoContext->overlayVisible) {
|
if (curTime - _lastSecondaryTap < 400 && !_videoContext->overlayInGUI) {
|
||||||
//printf("Right escape!\n");
|
//printf("Right escape!\n");
|
||||||
event.type = Common::EVENT_KEYDOWN;
|
event.type = Common::EVENT_KEYDOWN;
|
||||||
_queuedInputEvent.type = Common::EVENT_KEYUP;
|
_queuedInputEvent.type = Common::EVENT_KEYUP;
|
||||||
|
@ -235,8 +235,8 @@ bool OSystem_IPHONE::handleEvent_mouseDragged(Common::Event &event, int x, int y
|
||||||
mouseNewPosX = (int)(_videoContext->mouseX - deltaX / 0.5f);
|
mouseNewPosX = (int)(_videoContext->mouseX - deltaX / 0.5f);
|
||||||
mouseNewPosY = (int)(_videoContext->mouseY - deltaY / 0.5f);
|
mouseNewPosY = (int)(_videoContext->mouseY - deltaY / 0.5f);
|
||||||
|
|
||||||
int widthCap = _videoContext->overlayVisible ? _videoContext->overlayWidth : _videoContext->screenWidth;
|
int widthCap = _videoContext->overlayInGUI ? _videoContext->overlayWidth : _videoContext->screenWidth;
|
||||||
int heightCap = _videoContext->overlayVisible ? _videoContext->overlayHeight : _videoContext->screenHeight;
|
int heightCap = _videoContext->overlayInGUI ? _videoContext->overlayHeight : _videoContext->screenHeight;
|
||||||
|
|
||||||
if (mouseNewPosX < 0)
|
if (mouseNewPosX < 0)
|
||||||
mouseNewPosX = 0;
|
mouseNewPosX = 0;
|
||||||
|
|
|
@ -145,7 +145,7 @@ public:
|
||||||
virtual void unlockScreen();
|
virtual void unlockScreen();
|
||||||
virtual void setShakePos(int shakeXOffset, int shakeYOffset);
|
virtual void setShakePos(int shakeXOffset, int shakeYOffset);
|
||||||
|
|
||||||
virtual void showOverlay();
|
virtual void showOverlay(bool inGUI);
|
||||||
virtual void hideOverlay();
|
virtual void hideOverlay();
|
||||||
virtual bool isOverlayVisible() const { return _videoContext->overlayVisible; }
|
virtual bool isOverlayVisible() const { return _videoContext->overlayVisible; }
|
||||||
virtual void clearOverlay();
|
virtual void clearOverlay();
|
||||||
|
|
|
@ -279,9 +279,10 @@ void OSystem_IPHONE::setShakePos(int shakeXOffset, int shakeYOffset) {
|
||||||
_mouseDirty = true;
|
_mouseDirty = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void OSystem_IPHONE::showOverlay() {
|
void OSystem_IPHONE::showOverlay(bool inGUI) {
|
||||||
//printf("showOverlay()\n");
|
//printf("showOverlay()\n");
|
||||||
_videoContext->overlayVisible = true;
|
_videoContext->overlayVisible = true;
|
||||||
|
_videoContext->overlayInGUI = inGUI;
|
||||||
dirtyFullOverlayScreen();
|
dirtyFullOverlayScreen();
|
||||||
updateScreen();
|
updateScreen();
|
||||||
[g_iPhoneViewInstance performSelectorOnMainThread:@selector(updateMouseCursorScaling) withObject:nil waitUntilDone: YES];
|
[g_iPhoneViewInstance performSelectorOnMainThread:@selector(updateMouseCursorScaling) withObject:nil waitUntilDone: YES];
|
||||||
|
@ -291,6 +292,7 @@ void OSystem_IPHONE::showOverlay() {
|
||||||
void OSystem_IPHONE::hideOverlay() {
|
void OSystem_IPHONE::hideOverlay() {
|
||||||
//printf("hideOverlay()\n");
|
//printf("hideOverlay()\n");
|
||||||
_videoContext->overlayVisible = false;
|
_videoContext->overlayVisible = false;
|
||||||
|
_videoContext->overlayInGUI = false;
|
||||||
_dirtyOverlayRects.clear();
|
_dirtyOverlayRects.clear();
|
||||||
dirtyFullScreen();
|
dirtyFullScreen();
|
||||||
[g_iPhoneViewInstance performSelectorOnMainThread:@selector(updateMouseCursorScaling) withObject:nil waitUntilDone: YES];
|
[g_iPhoneViewInstance performSelectorOnMainThread:@selector(updateMouseCursorScaling) withObject:nil waitUntilDone: YES];
|
||||||
|
|
|
@ -109,6 +109,7 @@ protected:
|
||||||
|
|
||||||
uint16 _overlayHeight, _overlayWidth;
|
uint16 _overlayHeight, _overlayWidth;
|
||||||
bool _overlayVisible;
|
bool _overlayVisible;
|
||||||
|
bool _overlayInGUI;
|
||||||
|
|
||||||
bool _disableFpsLimit; // When this is enabled, the system doesn't limit screen updates
|
bool _disableFpsLimit; // When this is enabled, the system doesn't limit screen updates
|
||||||
|
|
||||||
|
@ -164,7 +165,7 @@ public:
|
||||||
virtual void unlockScreen();
|
virtual void unlockScreen();
|
||||||
virtual void setShakePos(int shakeXOffset, int shakeYOffset);
|
virtual void setShakePos(int shakeXOffset, int shakeYOffset);
|
||||||
|
|
||||||
virtual void showOverlay();
|
virtual void showOverlay(bool inGUI);
|
||||||
virtual void hideOverlay();
|
virtual void hideOverlay();
|
||||||
virtual bool isOverlayVisible() const { return _overlayVisible; }
|
virtual bool isOverlayVisible() const { return _overlayVisible; }
|
||||||
virtual void clearOverlay();
|
virtual void clearOverlay();
|
||||||
|
|
|
@ -90,6 +90,7 @@ OSystem_N64::OSystem_N64() {
|
||||||
_disableFpsLimit = false;
|
_disableFpsLimit = false;
|
||||||
|
|
||||||
_overlayVisible = false;
|
_overlayVisible = false;
|
||||||
|
_overlayInGUI = false;
|
||||||
|
|
||||||
_shakeXOffset = 0;
|
_shakeXOffset = 0;
|
||||||
_shakeYOffset = 0;
|
_shakeYOffset = 0;
|
||||||
|
@ -613,27 +614,34 @@ void OSystem_N64::setShakePos(int shakeXOffset, int shakeYOffset) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
void OSystem_N64::showOverlay() {
|
void OSystem_N64::showOverlay(bool inGUI) {
|
||||||
// Change min/max mouse coords
|
_overlayInGUI = inGUI;
|
||||||
_mouseMaxX = _overlayWidth;
|
|
||||||
_mouseMaxY = _overlayHeight;
|
|
||||||
|
|
||||||
// Relocate the mouse cursor given the new limitations
|
if (inGUI) {
|
||||||
warpMouse(_mouseX, _mouseY);
|
// Change min/max mouse coords
|
||||||
|
_mouseMaxX = _overlayWidth;
|
||||||
|
_mouseMaxY = _overlayHeight;
|
||||||
|
|
||||||
|
// Relocate the mouse cursor given the new limitations
|
||||||
|
warpMouse(_mouseX, _mouseY);
|
||||||
|
}
|
||||||
|
|
||||||
_overlayVisible = true;
|
_overlayVisible = true;
|
||||||
_dirtyOffscreen = true;
|
_dirtyOffscreen = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void OSystem_N64::hideOverlay() {
|
void OSystem_N64::hideOverlay() {
|
||||||
// Change min/max mouse coords
|
if (_overlayInGUI) {
|
||||||
_mouseMaxX = _gameWidth;
|
// Change min/max mouse coords
|
||||||
_mouseMaxY = _gameHeight;
|
_mouseMaxX = _gameWidth;
|
||||||
|
_mouseMaxY = _gameHeight;
|
||||||
|
|
||||||
// Relocate the mouse cursor given the new limitations
|
// Relocate the mouse cursor given the new limitations
|
||||||
warpMouse(_mouseX, _mouseY);
|
warpMouse(_mouseX, _mouseY);
|
||||||
|
}
|
||||||
|
|
||||||
_overlayVisible = false;
|
_overlayVisible = false;
|
||||||
|
_overlayInGUI = false;
|
||||||
|
|
||||||
// Clear double buffered display
|
// Clear double buffered display
|
||||||
clearAllVideoBuffers();
|
clearAllVideoBuffers();
|
||||||
|
|
|
@ -229,12 +229,14 @@ void OSystem_PSP::setShakePos(int shakeXOffset, int shakeYOffset) {
|
||||||
_screen.setShakePos(shakeXOffset, shakeYOffset);
|
_screen.setShakePos(shakeXOffset, shakeYOffset);
|
||||||
}
|
}
|
||||||
|
|
||||||
void OSystem_PSP::showOverlay() {
|
void OSystem_PSP::showOverlay(bool inGUI) {
|
||||||
DEBUG_ENTER_FUNC();
|
DEBUG_ENTER_FUNC();
|
||||||
_pendingUpdate = false;
|
_pendingUpdate = false;
|
||||||
_overlay.setVisible(true);
|
_overlay.setVisible(true);
|
||||||
_cursor.setLimits(_overlay.getWidth(), _overlay.getHeight());
|
if (inGUI) {
|
||||||
_cursor.useGlobalScaler(false); // mouse with overlay is 1:1
|
_cursor.setLimits(_overlay.getWidth(), _overlay.getHeight());
|
||||||
|
_cursor.useGlobalScaler(false); // mouse with overlay is 1:1
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void OSystem_PSP::hideOverlay() {
|
void OSystem_PSP::hideOverlay() {
|
||||||
|
|
|
@ -101,7 +101,7 @@ public:
|
||||||
void setShakePos(int shakeXOffset, int shakeYOffset);
|
void setShakePos(int shakeXOffset, int shakeYOffset);
|
||||||
|
|
||||||
// Overlay related
|
// Overlay related
|
||||||
void showOverlay();
|
void showOverlay(bool inGUI);
|
||||||
void hideOverlay();
|
void hideOverlay();
|
||||||
bool isOverlayVisible() const;
|
bool isOverlayVisible() const;
|
||||||
void clearOverlay();
|
void clearOverlay();
|
||||||
|
|
|
@ -39,6 +39,7 @@
|
||||||
OSystem_Wii::OSystem_Wii() :
|
OSystem_Wii::OSystem_Wii() :
|
||||||
_startup_time(0),
|
_startup_time(0),
|
||||||
|
|
||||||
|
_overlayInGUI(false),
|
||||||
_cursorDontScale(true),
|
_cursorDontScale(true),
|
||||||
_cursorPaletteDisabled(true),
|
_cursorPaletteDisabled(true),
|
||||||
_cursorPalette(NULL),
|
_cursorPalette(NULL),
|
||||||
|
|
|
@ -75,6 +75,7 @@ private:
|
||||||
gfx_screen_coords_t _coordsOverlay;
|
gfx_screen_coords_t _coordsOverlay;
|
||||||
gfx_tex_t _texOverlay;
|
gfx_tex_t _texOverlay;
|
||||||
bool _overlayDirty;
|
bool _overlayDirty;
|
||||||
|
bool _overlayInGUI;
|
||||||
|
|
||||||
u32 _lastScreenUpdate;
|
u32 _lastScreenUpdate;
|
||||||
u16 _currentWidth, _currentHeight;
|
u16 _currentWidth, _currentHeight;
|
||||||
|
@ -173,7 +174,7 @@ public:
|
||||||
void unlockScreen() override;
|
void unlockScreen() override;
|
||||||
void setShakePos(int shakeXOffset, int shakeYOffset) override;
|
void setShakePos(int shakeXOffset, int shakeYOffset) override;
|
||||||
|
|
||||||
void showOverlay() override;
|
void showOverlay(bool inGUI) override;
|
||||||
void hideOverlay() override;
|
void hideOverlay() override;
|
||||||
bool isOverlayVisible() const override { return _overlayVisible; }
|
bool isOverlayVisible() const override { return _overlayVisible; }
|
||||||
void clearOverlay() override;
|
void clearOverlay() override;
|
||||||
|
|
|
@ -113,7 +113,7 @@ void OSystem_Wii::deinitGfx() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void OSystem_Wii::updateScreenResolution() {
|
void OSystem_Wii::updateScreenResolution() {
|
||||||
if (_overlayVisible) {
|
if (_overlayInGUI) {
|
||||||
_currentWidth = _overlayWidth;
|
_currentWidth = _overlayWidth;
|
||||||
_currentHeight = _overlayHeight;
|
_currentHeight = _overlayHeight;
|
||||||
} else {
|
} else {
|
||||||
|
@ -554,17 +554,23 @@ void OSystem_Wii::setShakePos(int shakeXOffset, int shakeYOffset) {
|
||||||
_coordsGame.y -= f32(shakeYOffset) * _currentYScale;
|
_coordsGame.y -= f32(shakeYOffset) * _currentYScale;
|
||||||
}
|
}
|
||||||
|
|
||||||
void OSystem_Wii::showOverlay() {
|
void OSystem_Wii::showOverlay(bool inGUI) {
|
||||||
_mouseX = _overlayWidth / 2;
|
if (inGUI) {
|
||||||
_mouseY = _overlayHeight / 2;
|
_mouseX = _overlayWidth / 2;
|
||||||
|
_mouseY = _overlayHeight / 2;
|
||||||
|
}
|
||||||
|
_overlayInGUI = inGUI;
|
||||||
_overlayVisible = true;
|
_overlayVisible = true;
|
||||||
updateScreenResolution();
|
updateScreenResolution();
|
||||||
gfx_tex_set_bilinear_filter(&_texMouse, true);
|
gfx_tex_set_bilinear_filter(&_texMouse, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void OSystem_Wii::hideOverlay() {
|
void OSystem_Wii::hideOverlay() {
|
||||||
_mouseX = _gameWidth / 2;
|
if (_overlayInGUI) {
|
||||||
_mouseY = _gameHeight / 2;
|
_mouseX = _gameWidth / 2;
|
||||||
|
_mouseY = _gameHeight / 2;
|
||||||
|
}
|
||||||
|
_overlayInGUI = false;
|
||||||
_overlayVisible = false;
|
_overlayVisible = false;
|
||||||
updateScreenResolution();
|
updateScreenResolution();
|
||||||
gfx_tex_set_bilinear_filter(&_texMouse, _bilinearFilter);
|
gfx_tex_set_bilinear_filter(&_texMouse, _bilinearFilter);
|
||||||
|
|
|
@ -1181,10 +1181,13 @@ public:
|
||||||
* and then manually compose whatever graphics we want to show in the overlay.
|
* and then manually compose whatever graphics we want to show in the overlay.
|
||||||
* This works because we assume the game to be "paused" whenever an overlay
|
* This works because we assume the game to be "paused" whenever an overlay
|
||||||
* is active.
|
* is active.
|
||||||
|
*
|
||||||
|
* @param inGame Whether the overlay is used to display GUI or in game images
|
||||||
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/** Activate the overlay mode. */
|
/** Activate the overlay mode. */
|
||||||
virtual void showOverlay() = 0;
|
virtual void showOverlay(bool inGUI = true) = 0;
|
||||||
|
|
||||||
/** Deactivate the overlay mode. */
|
/** Deactivate the overlay mode. */
|
||||||
virtual void hideOverlay() = 0;
|
virtual void hideOverlay() = 0;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue