Retrieve SDL window settings instead of using magic numbers

pull/456/head
Xenkhan 7 years ago committed by GitHub
parent 101f0b1579
commit 24ddb66af9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -383,18 +383,17 @@ void OMW::Engine::createWindow(Settings::Manager& settings)
osg::ref_ptr<osg::GraphicsContext::Traits> traits = new osg::GraphicsContext::Traits;
SDL_GetWindowPosition(mWindow, &traits->x, &traits->y);
SDL_GetWindowSize(mWindow, &traits->width, &traits->height);
SDL_GL_GetAttribute(SDL_GL_RED_SIZE, reinterpret_cast<int*>(&traits->red));
SDL_GL_GetAttribute(SDL_GL_GREEN_SIZE, reinterpret_cast<int*>(&traits->green));
SDL_GL_GetAttribute(SDL_GL_BLUE_SIZE, reinterpret_cast<int*>(&traits->blue));
SDL_GL_GetAttribute(SDL_GL_DEPTH_SIZE, reinterpret_cast<int*>(&traits->depth));
SDL_GL_GetAttribute(SDL_GL_STENCIL_SIZE, reinterpret_cast<int*>(&traits->stencil));
SDL_GL_GetAttribute(SDL_GL_DOUBLEBUFFER, reinterpret_cast<int*>(&traits->doubleBuffer));
traits->windowName = SDL_GetWindowTitle(mWindow);
traits->windowDecoration = !(SDL_GetWindowFlags(mWindow)&SDL_WINDOW_BORDERLESS);
traits->screenNum = SDL_GetWindowDisplayIndex(mWindow);
// FIXME: Some way to get these settings back from the SDL window?
traits->red = 8;
traits->green = 8;
traits->blue = 8;
traits->alpha = 0; // set to 0 to stop ScreenCaptureHandler reading the alpha channel
traits->depth = 24;
traits->stencil = 8;
traits->vsync = vsync;
traits->doubleBuffer = true;
traits->alpha = 0; // set to 0 to stop ScreenCaptureHandler reading the alpha channel
traits->inheritedWindowData = new SDLUtil::GraphicsWindowSDL2::WindowData(mWindow);
osg::ref_ptr<SDLUtil::GraphicsWindowSDL2> graphicsWindow = new SDLUtil::GraphicsWindowSDL2(traits);

Loading…
Cancel
Save