2010-07-09 19:45:56 +00:00
|
|
|
/* ScummVM - Graphic Adventure Engine
|
|
|
|
*
|
|
|
|
* ScummVM is the legal property of its developers, whose names
|
|
|
|
* are too numerous to list here. Please refer to the COPYRIGHT
|
|
|
|
* file distributed with this source distribution.
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
|
|
*
|
|
|
|
* $URL$
|
|
|
|
* $Id$
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2010-07-13 05:38:10 +00:00
|
|
|
#ifdef USE_OPENGL
|
|
|
|
|
2010-07-09 19:45:56 +00:00
|
|
|
#include "backends/graphics/openglsdl/openglsdl-graphics.h"
|
2010-07-19 05:36:10 +00:00
|
|
|
#include "backends/platform/sdl/sdl.h"
|
2010-07-09 19:45:56 +00:00
|
|
|
|
2010-07-11 04:32:24 +00:00
|
|
|
OpenGLSdlGraphicsManager::OpenGLSdlGraphicsManager()
|
2010-07-10 22:47:29 +00:00
|
|
|
:
|
2010-07-20 00:21:17 +00:00
|
|
|
_hwscreen(0),
|
|
|
|
_screenResized(false) {
|
2010-07-09 19:45:56 +00:00
|
|
|
|
|
|
|
if (SDL_InitSubSystem(SDL_INIT_VIDEO) == -1) {
|
|
|
|
error("Could not initialize SDL: %s", SDL_GetError());
|
|
|
|
}
|
|
|
|
|
2010-07-10 22:47:29 +00:00
|
|
|
SDL_ShowCursor(SDL_DISABLE);
|
2010-07-15 04:01:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
OpenGLSdlGraphicsManager::~OpenGLSdlGraphicsManager() {
|
2010-07-10 22:47:29 +00:00
|
|
|
|
2010-07-09 19:45:56 +00:00
|
|
|
}
|
|
|
|
|
2010-07-24 05:54:51 +00:00
|
|
|
|
|
|
|
bool OpenGLSdlGraphicsManager::hasFeature(OSystem::Feature f) {
|
|
|
|
return
|
|
|
|
(f == OSystem::kFeatureFullscreenMode) ||
|
|
|
|
(f == OSystem::kFeatureIconifyWindow) ||
|
|
|
|
OpenGLGraphicsManager::hasFeature(f);
|
|
|
|
}
|
|
|
|
|
|
|
|
void OpenGLSdlGraphicsManager::setFeatureState(OSystem::Feature f, bool enable) {
|
|
|
|
switch (f) {
|
|
|
|
case OSystem::kFeatureFullscreenMode:
|
|
|
|
setFullscreenMode(enable);
|
|
|
|
break;
|
|
|
|
case OSystem::kFeatureIconifyWindow:
|
|
|
|
if (enable)
|
|
|
|
SDL_WM_IconifyWindow();
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
OpenGLGraphicsManager::setFeatureState(f, enable);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-07-12 06:00:19 +00:00
|
|
|
#ifdef USE_RGB_COLOR
|
|
|
|
|
|
|
|
const Graphics::PixelFormat RGBList[] = {
|
|
|
|
#if defined(ENABLE_32BIT)
|
2010-07-26 06:58:33 +00:00
|
|
|
Graphics::PixelFormat(4, 8, 8, 8, 8, 24, 16, 8, 0), // RGBA8888
|
|
|
|
Graphics::PixelFormat(3, 8, 8, 8, 0, 16, 8, 0, 0), // RGB888
|
2010-07-12 06:00:19 +00:00
|
|
|
#endif
|
2010-07-26 06:58:33 +00:00
|
|
|
Graphics::PixelFormat(2, 5, 6, 5, 0, 11, 5, 0, 0), // RGB565
|
|
|
|
Graphics::PixelFormat(2, 5, 5, 5, 0, 10, 5, 0, 0), // RGB555
|
|
|
|
Graphics::PixelFormat(2, 4, 4, 4, 4, 12, 8, 4, 0), // RGBA4444
|
2010-07-12 06:00:19 +00:00
|
|
|
};
|
|
|
|
|
2010-07-13 04:31:15 +00:00
|
|
|
Common::List<Graphics::PixelFormat> OpenGLSdlGraphicsManager::getSupportedFormats() const {
|
2010-07-12 06:00:19 +00:00
|
|
|
static Common::List<Graphics::PixelFormat> list;
|
|
|
|
static bool inited = false;
|
|
|
|
|
|
|
|
if (inited)
|
|
|
|
return list;
|
|
|
|
|
|
|
|
int listLength = ARRAYSIZE(RGBList);
|
|
|
|
|
|
|
|
Graphics::PixelFormat format = Graphics::PixelFormat::createFormatCLUT8();
|
|
|
|
if (_hwscreen) {
|
|
|
|
// Get our currently set hardware format
|
|
|
|
format = Graphics::PixelFormat(_hwscreen->format->BytesPerPixel,
|
|
|
|
8 - _hwscreen->format->Rloss, 8 - _hwscreen->format->Gloss,
|
|
|
|
8 - _hwscreen->format->Bloss, 8 - _hwscreen->format->Aloss,
|
|
|
|
_hwscreen->format->Rshift, _hwscreen->format->Gshift,
|
|
|
|
_hwscreen->format->Bshift, _hwscreen->format->Ashift);
|
|
|
|
|
|
|
|
// Workaround to MacOSX SDL not providing an accurate Aloss value.
|
|
|
|
if (_hwscreen->format->Amask == 0)
|
|
|
|
format.aLoss = 8;
|
|
|
|
|
|
|
|
// Push it first, as the prefered format.
|
|
|
|
for (int i = 0; i < listLength; i++) {
|
|
|
|
if (RGBList[i] == format) {
|
|
|
|
list.push_back(format);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Mark that we don't need to do this any more.
|
|
|
|
inited = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
for (int i = 0; i < listLength; i++) {
|
|
|
|
if (inited && (RGBList[i].bytesPerPixel > format.bytesPerPixel))
|
|
|
|
continue;
|
|
|
|
if (RGBList[i] != format)
|
|
|
|
list.push_back(RGBList[i]);
|
|
|
|
}
|
2010-07-27 00:30:37 +00:00
|
|
|
list.push_back(Graphics::PixelFormat::createFormatCLUT8());
|
2010-07-12 06:00:19 +00:00
|
|
|
return list;
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
void OpenGLSdlGraphicsManager::warpMouse(int x, int y) {
|
2010-07-18 03:25:58 +00:00
|
|
|
if (_cursorState.x != x || _cursorState.y != y) {
|
2010-07-12 06:00:19 +00:00
|
|
|
int y1 = y;
|
|
|
|
|
|
|
|
/*if (_videoMode.aspectRatioCorrection && !_overlayVisible)
|
|
|
|
y1 = real2Aspect(y);*/
|
|
|
|
|
|
|
|
if (!_overlayVisible)
|
|
|
|
SDL_WarpMouse(x * _videoMode.scaleFactor, y1 * _videoMode.scaleFactor);
|
|
|
|
else
|
|
|
|
SDL_WarpMouse(x, y1);
|
|
|
|
|
|
|
|
setMousePos(x, y);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-07-10 22:47:29 +00:00
|
|
|
//
|
2010-07-11 04:32:24 +00:00
|
|
|
// Intern
|
2010-07-10 22:47:29 +00:00
|
|
|
//
|
|
|
|
|
2010-07-11 04:32:24 +00:00
|
|
|
bool OpenGLSdlGraphicsManager::loadGFXMode() {
|
|
|
|
_videoMode.overlayWidth = _videoMode.screenWidth * _videoMode.scaleFactor;
|
|
|
|
_videoMode.overlayHeight = _videoMode.screenHeight * _videoMode.scaleFactor;
|
2010-07-27 00:30:37 +00:00
|
|
|
|
|
|
|
// If the screen was resized, do not change its size
|
2010-07-20 00:21:17 +00:00
|
|
|
if (!_screenResized) {
|
2010-07-23 06:57:23 +00:00
|
|
|
_videoMode.hardwareWidth = _videoMode.overlayWidth;
|
|
|
|
_videoMode.hardwareHeight = _videoMode.overlayHeight;
|
2010-07-20 00:21:17 +00:00
|
|
|
}
|
|
|
|
_screenResized = false;
|
2010-07-11 04:32:24 +00:00
|
|
|
|
2010-07-18 05:32:44 +00:00
|
|
|
// Setup OpenGL attributes for SDL
|
|
|
|
SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 8);
|
|
|
|
SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 8);
|
|
|
|
SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 8);
|
|
|
|
SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 16);
|
|
|
|
SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);
|
|
|
|
|
2010-07-27 00:30:37 +00:00
|
|
|
// Find the best mode for fullscreen
|
2010-07-20 04:32:31 +00:00
|
|
|
if (_videoMode.fullscreen) {
|
|
|
|
SDL_Rect const* const*availableModes = SDL_ListModes(NULL, SDL_FULLSCREEN | SDL_OPENGL);
|
|
|
|
const SDL_Rect *bestMode = NULL;
|
|
|
|
uint bestMetric = (uint)-1;
|
2010-07-27 00:30:37 +00:00
|
|
|
|
|
|
|
// Iterate over all available fullscreen modes
|
2010-07-20 04:32:31 +00:00
|
|
|
while (const SDL_Rect *mode = *availableModes++) {
|
|
|
|
if (mode->w < _videoMode.hardwareWidth)
|
|
|
|
continue;
|
|
|
|
if (mode->h < _videoMode.hardwareHeight)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
uint metric = mode->w * mode->h - _videoMode.hardwareWidth * _videoMode.hardwareHeight;
|
|
|
|
if (metric > bestMetric)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
bestMode = mode;
|
|
|
|
bestMetric = metric;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (bestMode) {
|
2010-07-27 00:30:37 +00:00
|
|
|
// If there is a suiting mode, use it
|
2010-07-20 04:32:31 +00:00
|
|
|
_videoMode.hardwareWidth = bestMode->w;
|
|
|
|
_videoMode.hardwareHeight = bestMode->h;
|
|
|
|
} else {
|
2010-07-27 00:30:37 +00:00
|
|
|
// If the last mode was in fullscreen, cancel GFX load
|
2010-07-26 04:40:00 +00:00
|
|
|
if (_oldVideoMode.fullscreen)
|
|
|
|
return false;
|
2010-07-27 00:30:37 +00:00
|
|
|
|
2010-07-20 04:32:31 +00:00
|
|
|
_videoMode.fullscreen = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-07-27 00:30:37 +00:00
|
|
|
// If changing to any fullscreen mode or from fullscreen,
|
|
|
|
// the OpenGL context is destroyed
|
2010-07-22 15:36:50 +00:00
|
|
|
if (_oldVideoMode.fullscreen || _videoMode.fullscreen)
|
2010-07-20 04:32:31 +00:00
|
|
|
_transactionDetails.newContext = true;
|
|
|
|
|
2010-07-27 00:30:37 +00:00
|
|
|
// Create our window
|
2010-07-11 04:32:24 +00:00
|
|
|
_hwscreen = SDL_SetVideoMode(_videoMode.hardwareWidth, _videoMode.hardwareHeight, 32,
|
2010-07-19 05:36:10 +00:00
|
|
|
_videoMode.fullscreen ? (SDL_FULLSCREEN | SDL_OPENGL) : (SDL_OPENGL | SDL_RESIZABLE)
|
2010-07-11 04:32:24 +00:00
|
|
|
);
|
|
|
|
if (_hwscreen == NULL) {
|
|
|
|
// DON'T use error(), as this tries to bring up the debug
|
|
|
|
// console, which WON'T WORK now that _hwscreen is hosed.
|
|
|
|
|
|
|
|
if (!_oldVideoMode.setup) {
|
|
|
|
warning("SDL_SetVideoMode says we can't switch to that mode (%s)", SDL_GetError());
|
|
|
|
g_system->quit();
|
2010-07-27 00:30:37 +00:00
|
|
|
} else
|
|
|
|
// Cancel GFX load, and go back to last mode
|
2010-07-11 04:32:24 +00:00
|
|
|
return false;
|
|
|
|
}
|
2010-07-10 22:47:29 +00:00
|
|
|
|
2010-07-27 00:30:37 +00:00
|
|
|
// Check if the screen is BGR format
|
2010-07-26 06:52:58 +00:00
|
|
|
_formatBGR = _hwscreen->format->Rshift != 0;
|
|
|
|
|
2010-07-27 00:30:37 +00:00
|
|
|
// Call and return parent implementation of this method
|
2010-07-12 06:00:19 +00:00
|
|
|
return OpenGLGraphicsManager::loadGFXMode();
|
2010-07-11 04:32:24 +00:00
|
|
|
}
|
2010-07-10 22:47:29 +00:00
|
|
|
|
2010-07-11 04:32:24 +00:00
|
|
|
void OpenGLSdlGraphicsManager::unloadGFXMode() {
|
|
|
|
if (_hwscreen) {
|
|
|
|
SDL_FreeSurface(_hwscreen);
|
|
|
|
_hwscreen = NULL;
|
|
|
|
}
|
2010-07-10 22:47:29 +00:00
|
|
|
}
|
|
|
|
|
2010-07-11 04:32:24 +00:00
|
|
|
void OpenGLSdlGraphicsManager::internUpdateScreen() {
|
2010-07-27 00:30:37 +00:00
|
|
|
// Call to parent implementation of this method
|
2010-07-16 04:45:47 +00:00
|
|
|
OpenGLGraphicsManager::internUpdateScreen();
|
|
|
|
|
2010-07-27 00:30:37 +00:00
|
|
|
// Swap OpenGL buffers
|
2010-07-16 04:45:47 +00:00
|
|
|
SDL_GL_SwapBuffers();
|
2010-07-10 22:47:29 +00:00
|
|
|
}
|
2010-07-13 05:38:10 +00:00
|
|
|
|
2010-07-19 05:36:10 +00:00
|
|
|
bool OpenGLSdlGraphicsManager::handleScalerHotkeys(Common::KeyCode key) {
|
|
|
|
|
|
|
|
// Ctrl-Alt-a toggles aspect ratio correction
|
2010-07-24 05:54:51 +00:00
|
|
|
if (key == 'a') {
|
2010-07-19 05:36:10 +00:00
|
|
|
beginGFXTransaction();
|
2010-07-24 05:54:51 +00:00
|
|
|
setAspectRatioCorrection(-1);
|
2010-07-19 05:36:10 +00:00
|
|
|
endGFXTransaction();
|
|
|
|
#ifdef USE_OSD
|
|
|
|
char buffer[128];
|
|
|
|
if (_videoMode.aspectRatioCorrection)
|
|
|
|
sprintf(buffer, "Enabled aspect ratio correction\n%d x %d -> %d x %d",
|
|
|
|
_videoMode.screenWidth, _videoMode.screenHeight,
|
|
|
|
_hwscreen->w, _hwscreen->h
|
|
|
|
);
|
|
|
|
else
|
|
|
|
sprintf(buffer, "Disabled aspect ratio correction\n%d x %d -> %d x %d",
|
|
|
|
_videoMode.screenWidth, _videoMode.screenHeight,
|
|
|
|
_hwscreen->w, _hwscreen->h
|
|
|
|
);
|
|
|
|
displayMessageOnOSD(buffer);
|
|
|
|
#endif
|
|
|
|
internUpdateScreen();
|
|
|
|
return true;
|
2010-07-24 05:54:51 +00:00
|
|
|
}
|
2010-07-19 05:36:10 +00:00
|
|
|
|
2010-07-22 15:36:50 +00:00
|
|
|
// Ctrl-Alt-f toggles antialiasing
|
|
|
|
if (key == 'f') {
|
|
|
|
beginGFXTransaction();
|
|
|
|
_videoMode.antialiasing = !_videoMode.antialiasing;
|
|
|
|
_transactionDetails.filterChanged = true;
|
|
|
|
endGFXTransaction();
|
2010-07-26 06:03:55 +00:00
|
|
|
#ifdef USE_OSD
|
|
|
|
if (_videoMode.antialiasing)
|
|
|
|
displayMessageOnOSD("Active filter mode: Linear");
|
|
|
|
else
|
|
|
|
displayMessageOnOSD("Active filter mode: Nearest");
|
|
|
|
#endif
|
2010-07-22 15:36:50 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2010-07-19 05:36:10 +00:00
|
|
|
SDLKey sdlKey = (SDLKey)key;
|
|
|
|
|
|
|
|
// Increase/decrease the scale factor
|
|
|
|
if (sdlKey == SDLK_EQUALS || sdlKey == SDLK_PLUS || sdlKey == SDLK_MINUS ||
|
|
|
|
sdlKey == SDLK_KP_PLUS || sdlKey == SDLK_KP_MINUS) {
|
|
|
|
int factor = _videoMode.scaleFactor;
|
|
|
|
factor += (sdlKey == SDLK_MINUS || sdlKey == SDLK_KP_MINUS) ? -1 : +1;
|
|
|
|
if (0 < factor && factor < 4) {
|
|
|
|
beginGFXTransaction();
|
|
|
|
setScale(factor);
|
|
|
|
endGFXTransaction();
|
2010-07-26 06:03:55 +00:00
|
|
|
#ifdef USE_OSD
|
|
|
|
const char *newScalerName = 0;
|
|
|
|
const OSystem::GraphicsMode *g = getSupportedGraphicsModes();
|
|
|
|
while (g->name) {
|
|
|
|
if (g->id == _videoMode.mode) {
|
|
|
|
newScalerName = g->description;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
g++;
|
|
|
|
}
|
|
|
|
if (newScalerName) {
|
|
|
|
char buffer[128];
|
|
|
|
sprintf(buffer, "Active graphics mode: %s\n%d x %d -> %d x %d",
|
|
|
|
newScalerName,
|
|
|
|
_videoMode.screenWidth, _videoMode.screenHeight,
|
|
|
|
_hwscreen->w, _hwscreen->h
|
|
|
|
);
|
|
|
|
displayMessageOnOSD(buffer);
|
|
|
|
}
|
|
|
|
#endif
|
2010-07-22 15:36:50 +00:00
|
|
|
return true;
|
|
|
|
}
|
2010-07-19 05:36:10 +00:00
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
void OpenGLSdlGraphicsManager::setFullscreenMode(bool enable) {
|
2010-07-20 04:32:31 +00:00
|
|
|
if (_oldVideoMode.setup && _oldVideoMode.fullscreen == enable)
|
|
|
|
return;
|
2010-07-19 05:36:10 +00:00
|
|
|
|
2010-07-20 04:32:31 +00:00
|
|
|
if (_transactionMode == kTransactionActive) {
|
|
|
|
_videoMode.fullscreen = enable;
|
|
|
|
_transactionDetails.needHotswap = true;
|
|
|
|
}
|
2010-07-19 05:36:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
bool OpenGLSdlGraphicsManager::isScalerHotkey(const Common::Event &event) {
|
|
|
|
if ((event.kbd.flags & (Common::KBD_CTRL|Common::KBD_ALT)) == (Common::KBD_CTRL|Common::KBD_ALT)) {
|
|
|
|
const bool isScaleKey = (event.kbd.keycode == Common::KEYCODE_EQUALS || event.kbd.keycode == Common::KEYCODE_PLUS || event.kbd.keycode == Common::KEYCODE_MINUS ||
|
|
|
|
event.kbd.keycode == Common::KEYCODE_KP_PLUS || event.kbd.keycode == Common::KEYCODE_KP_MINUS);
|
|
|
|
|
2010-07-22 15:36:50 +00:00
|
|
|
return (isScaleKey || event.kbd.keycode == 'a' || event.kbd.keycode == 'f');
|
2010-07-19 05:36:10 +00:00
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
void OpenGLSdlGraphicsManager::toggleFullScreen() {
|
|
|
|
beginGFXTransaction();
|
|
|
|
setFullscreenMode(!_videoMode.fullscreen);
|
|
|
|
endGFXTransaction();
|
|
|
|
#ifdef USE_OSD
|
|
|
|
if (_videoMode.fullscreen)
|
|
|
|
displayMessageOnOSD("Fullscreen mode");
|
|
|
|
else
|
|
|
|
displayMessageOnOSD("Windowed mode");
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
bool OpenGLSdlGraphicsManager::notifyEvent(const Common::Event &event) {
|
|
|
|
switch ((int)event.type) {
|
|
|
|
case Common::EVENT_KEYDOWN:
|
|
|
|
// Alt-Return and Alt-Enter toggle full screen mode
|
|
|
|
if (event.kbd.hasFlags(Common::KBD_ALT) &&
|
|
|
|
(event.kbd.keycode == Common::KEYCODE_RETURN ||
|
|
|
|
event.kbd.keycode == (Common::KeyCode)SDLK_KP_ENTER)) {
|
|
|
|
toggleFullScreen();
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Alt-S: Create a screenshot
|
|
|
|
if (event.kbd.hasFlags(Common::KBD_ALT) && event.kbd.keycode == 's') {
|
|
|
|
char filename[20];
|
|
|
|
|
|
|
|
for (int n = 0;; n++) {
|
|
|
|
SDL_RWops *file;
|
|
|
|
|
|
|
|
sprintf(filename, "scummvm%05d.bmp", n);
|
|
|
|
file = SDL_RWFromFile(filename, "r");
|
|
|
|
if (!file)
|
|
|
|
break;
|
|
|
|
SDL_RWclose(file);
|
|
|
|
}
|
|
|
|
if (saveScreenshot(filename))
|
|
|
|
printf("Saved '%s'\n", filename);
|
|
|
|
else
|
|
|
|
printf("Could not save screenshot!\n");
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Ctrl-Alt-<key> will change the GFX mode
|
|
|
|
if ((event.kbd.flags & (Common::KBD_CTRL|Common::KBD_ALT)) == (Common::KBD_CTRL|Common::KBD_ALT)) {
|
|
|
|
if (handleScalerHotkeys(event.kbd.keycode))
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
case Common::EVENT_KEYUP:
|
|
|
|
return isScalerHotkey(event);
|
|
|
|
/*case OSystem_SDL::kSdlEventExpose:
|
|
|
|
break;*/
|
|
|
|
// HACK: Handle special SDL event
|
|
|
|
case OSystem_SDL::kSdlEventResize:
|
2010-07-20 00:21:17 +00:00
|
|
|
beginGFXTransaction();
|
2010-07-27 00:30:37 +00:00
|
|
|
// Set the new screen size. It is saved on the mouse event as part of HACK,
|
|
|
|
// there is no common resize event
|
2010-07-20 00:21:17 +00:00
|
|
|
_videoMode.hardwareWidth = event.mouse.x;
|
|
|
|
_videoMode.hardwareHeight = event.mouse.y;
|
|
|
|
_screenResized = true;
|
|
|
|
_transactionDetails.sizeChanged = true;
|
2010-07-27 00:30:37 +00:00
|
|
|
// The OpenGL context is not always destroyed during resizing,
|
|
|
|
// however it is better to waste some time recreating it than
|
|
|
|
// getting a blank screen
|
2010-07-24 05:54:51 +00:00
|
|
|
_transactionDetails.newContext = true;
|
2010-07-20 00:21:17 +00:00
|
|
|
endGFXTransaction();
|
2010-07-19 05:36:10 +00:00
|
|
|
return true;
|
|
|
|
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return OpenGLGraphicsManager::notifyEvent(event);
|
|
|
|
}
|
|
|
|
|
2010-07-13 05:38:10 +00:00
|
|
|
#endif
|