Exemple #1
0
void MainWindow::ShowRenderWidget()
{
	Settings settings;
	if (settings.GetRenderToMain())
	{
		// If we're rendering to main, add it to the stack and update our title when necessary.
		m_rendering_to_main = true;
		m_stack->setCurrentIndex(m_stack->addWidget(m_render_widget));
		connect(Host::GetInstance(), &Host::RequestTitle, this, &MainWindow::setWindowTitle);
	}
	else
	{
		// Otherwise, just show it.
		m_rendering_to_main = false;
		if (settings.GetFullScreen())
		{
			m_render_widget->showFullScreen();
		}
		else
		{
			m_render_widget->setFixedSize(settings.GetRenderWindowSize());
			m_render_widget->showNormal();
		}
	}
}
void Application::InitVideo()
{
    Settings* set = Settings::Instance();
    UPoint resolution = set->GetResolution();
    
    int videoFlags = SDL_HWPALETTE | SDL_RESIZABLE;
    if (set->GetDoubleBuffered())
        videoFlags |= SDL_HWSURFACE | SDL_DOUBLEBUF;
    if (set->GetFullScreen())
        videoFlags |= SDL_FULLSCREEN;


    SDL_Surface *surface = SDL_SetVideoMode(resolution.x, resolution.y, 8, videoFlags);
    
    if(!surface) {
        LOG(LV_ERROR, "Application", "Couldn't set video mode: %s", SDL_GetError());
        Die();
    } else
	surface->flags |= SDL_PREALLOC;

    *m_screen = surface;
    
    // reset the palette if we've got one 
    if (m_currentPalette)
        SetPalette();

    SDL_ShowCursor(SDL_DISABLE);

    m_rootWidget->setSize(resolution);
    m_rootWidget->setPosition(UPoint(0, 0));
}