SDL: Refactor OpenGLSdlGraphics3dManager to inherit from SdlGraphicsManager

This commit is contained in:
Cameron Cawley 2021-04-09 23:32:45 +01:00 committed by Eugene Sandulenko
parent a409ad722f
commit d33487f641
14 changed files with 118 additions and 551 deletions

View file

@ -45,7 +45,7 @@
#endif
OpenGLSdlGraphics3dManager::OpenGLSdlGraphics3dManager(SdlEventSource *eventSource, SdlWindow *window, bool supportsFrameBuffer)
: SdlGraphics3dManager(eventSource, window),
: SdlGraphicsManager(eventSource, window),
#if SDL_VERSION_ATLEAST(2, 0, 0)
_glContext(nullptr),
#endif
@ -283,6 +283,8 @@ void OpenGLSdlGraphics3dManager::createOrUpdateScreen() {
int obtainedHeight = effectiveHeight;
#endif
handleResize(obtainedWidth, obtainedHeight);
// Compute the rectangle where to draw the game inside the effective screen
_gameRect = computeGameRect(renderToFrameBuffer, _engineRequestedWidth, _engineRequestedHeight,
obtainedWidth, obtainedHeight);
@ -671,6 +673,11 @@ int16 OpenGLSdlGraphics3dManager::getOverlayWidth() const {
return _overlayScreen->getWidth();
}
bool OpenGLSdlGraphics3dManager::showMouse(bool visible) {
SDL_ShowCursor(visible);
return true;
}
void OpenGLSdlGraphics3dManager::warpMouse(int x, int y) {
if (!_overlayVisible && _frameBuffer) {
// Scale from game coordinates to screen coordinates