SDL: Always initialize video subsystem in initSDL.
This commit is contained in:
parent
6e46e9dfaf
commit
1a56b521b5
6 changed files with 27 additions and 32 deletions
|
@ -32,11 +32,6 @@ OpenGLSdlGraphicsManager::OpenGLSdlGraphicsManager(uint desktopWidth, uint deskt
|
|||
: SdlGraphicsManager(eventSource), _lastVideoModeLoad(0), _hwScreen(nullptr), _lastRequestedWidth(0), _lastRequestedHeight(0),
|
||||
_graphicsScale(2), _ignoreLoadVideoMode(false), _gotResize(false), _wantsFullScreen(false), _ignoreResizeEvents(0),
|
||||
_desiredFullscreenWidth(0), _desiredFullscreenHeight(0) {
|
||||
// Initialize SDL video subsystem
|
||||
if (SDL_InitSubSystem(SDL_INIT_VIDEO) == -1) {
|
||||
error("Could not initialize SDL: %s", SDL_GetError());
|
||||
}
|
||||
|
||||
// Setup OpenGL attributes for SDL
|
||||
SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 8);
|
||||
SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 8);
|
||||
|
@ -44,13 +39,6 @@ OpenGLSdlGraphicsManager::OpenGLSdlGraphicsManager(uint desktopWidth, uint deskt
|
|||
SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 16);
|
||||
SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);
|
||||
|
||||
// This is also called in initSDL(), but initializing graphics
|
||||
// may reset it.
|
||||
SDL_EnableUNICODE(1);
|
||||
|
||||
// Disable OS cursor
|
||||
SDL_ShowCursor(SDL_DISABLE);
|
||||
|
||||
// Retrieve a list of working fullscreen modes
|
||||
const SDL_Rect *const *availableModes = SDL_ListModes(NULL, SDL_OPENGL | SDL_FULLSCREEN);
|
||||
if (availableModes != (void *)-1) {
|
||||
|
|
|
@ -142,14 +142,6 @@ SurfaceSdlGraphicsManager::SurfaceSdlGraphicsManager(SdlEventSource *sdlEventSou
|
|||
#endif
|
||||
_transactionMode(kTransactionNone) {
|
||||
|
||||
if (SDL_InitSubSystem(SDL_INIT_VIDEO) == -1) {
|
||||
error("Could not initialize SDL: %s", SDL_GetError());
|
||||
}
|
||||
|
||||
// This is also called in initSDL(), but initializing graphics
|
||||
// may reset it.
|
||||
SDL_EnableUNICODE(1);
|
||||
|
||||
// allocate palette storage
|
||||
_currentPalette = (SDL_Color *)calloc(sizeof(SDL_Color), 256);
|
||||
_cursorPalette = (SDL_Color *)calloc(sizeof(SDL_Color), 256);
|
||||
|
@ -165,8 +157,6 @@ SurfaceSdlGraphicsManager::SurfaceSdlGraphicsManager(SdlEventSource *sdlEventSou
|
|||
_enableFocusRectDebugCode = ConfMan.getBool("use_sdl_debug_focusrect");
|
||||
#endif
|
||||
|
||||
SDL_ShowCursor(SDL_DISABLE);
|
||||
|
||||
memset(&_oldVideoMode, 0, sizeof(_oldVideoMode));
|
||||
memset(&_videoMode, 0, sizeof(_videoMode));
|
||||
memset(&_transactionDetails, 0, sizeof(_transactionDetails));
|
||||
|
|
|
@ -172,7 +172,7 @@ void OSystem_GPH::initSDL() {
|
|||
// Check if SDL has not been initialized
|
||||
if (!_initedSDL) {
|
||||
|
||||
uint32 sdlFlags = SDL_INIT_EVENTTHREAD;
|
||||
uint32 sdlFlags = SDL_INIT_EVENTTHREAD | SDL_INIT_VIDEO;
|
||||
if (ConfMan.hasKey("disable_sdl_parachute"))
|
||||
sdlFlags |= SDL_INIT_NOPARACHUTE;
|
||||
|
||||
|
@ -180,6 +180,12 @@ void OSystem_GPH::initSDL() {
|
|||
if (SDL_Init(sdlFlags) == -1)
|
||||
error("Could not initialize SDL: %s", SDL_GetError());
|
||||
|
||||
// Enable unicode support if possible
|
||||
SDL_EnableUNICODE(1);
|
||||
|
||||
// Disable OS cursor
|
||||
SDL_ShowCursor(SDL_DISABLE);
|
||||
|
||||
_initedSDL = true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -160,7 +160,7 @@ void OSystem_OP::initSDL() {
|
|||
// Check if SDL has not been initialized
|
||||
if (!_initedSDL) {
|
||||
|
||||
uint32 sdlFlags = SDL_INIT_EVENTTHREAD;
|
||||
uint32 sdlFlags = SDL_INIT_EVENTTHREAD | SDL_INIT_VIDEO;
|
||||
if (ConfMan.hasKey("disable_sdl_parachute"))
|
||||
sdlFlags |= SDL_INIT_NOPARACHUTE;
|
||||
|
||||
|
@ -168,6 +168,12 @@ void OSystem_OP::initSDL() {
|
|||
if (SDL_Init(sdlFlags) == -1)
|
||||
error("Could not initialize SDL: %s", SDL_GetError());
|
||||
|
||||
// Enable unicode support if possible
|
||||
SDL_EnableUNICODE(1);
|
||||
|
||||
// Disable OS cursor
|
||||
SDL_ShowCursor(SDL_DISABLE);
|
||||
|
||||
_initedSDL = true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -262,16 +262,15 @@ void OSystem_SDL::engineDone() {
|
|||
void OSystem_SDL::initSDL() {
|
||||
// Check if SDL has not been initialized
|
||||
if (!_initedSDL) {
|
||||
uint32 sdlFlags = 0;
|
||||
// We always initialize the video subsystem because we will need it to
|
||||
// be initialized before the graphics managers to retrieve the desktop
|
||||
// resolution, for example. WebOS also requires this initialization
|
||||
// or otherwise the application won't start.
|
||||
uint32 sdlFlags = SDL_INIT_VIDEO;
|
||||
|
||||
if (ConfMan.hasKey("disable_sdl_parachute"))
|
||||
sdlFlags |= SDL_INIT_NOPARACHUTE;
|
||||
|
||||
#if defined(WEBOS) || defined(USE_OPENGL)
|
||||
// WebOS needs this flag or otherwise the application won't start.
|
||||
// OpenGL SDL needs this to query the desktop resolution on startup.
|
||||
sdlFlags |= SDL_INIT_VIDEO;
|
||||
#endif
|
||||
|
||||
// Initialize SDL (SDL Subsystems are initiliazed in the corresponding sdl managers)
|
||||
if (SDL_Init(sdlFlags) == -1)
|
||||
error("Could not initialize SDL: %s", SDL_GetError());
|
||||
|
@ -279,6 +278,9 @@ void OSystem_SDL::initSDL() {
|
|||
// Enable unicode support if possible
|
||||
SDL_EnableUNICODE(1);
|
||||
|
||||
// Disable OS cursor
|
||||
SDL_ShowCursor(SDL_DISABLE);
|
||||
|
||||
_initedSDL = true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -563,7 +563,7 @@ void OSystem_WINCE3::setGraphicsModeIntern() {
|
|||
void OSystem_WINCE3::initSDL() {
|
||||
// Check if SDL has not been initialized
|
||||
if (!_initedSDL) {
|
||||
uint32 sdlFlags = SDL_INIT_EVENTTHREAD;
|
||||
uint32 sdlFlags = SDL_INIT_EVENTTHREAD | SDL_INIT_VIDEO;
|
||||
if (ConfMan.hasKey("disable_sdl_parachute"))
|
||||
sdlFlags |= SDL_INIT_NOPARACHUTE;
|
||||
|
||||
|
@ -579,6 +579,9 @@ void OSystem_WINCE3::initSDL() {
|
|||
// Enable unicode support if possible
|
||||
SDL_EnableUNICODE(1);
|
||||
|
||||
// Disable OS cursor
|
||||
SDL_ShowCursor(SDL_DISABLE);
|
||||
|
||||
_initedSDL = true;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue