mirror of
https://github.com/4ian/GDevelop.git
synced 2025-10-15 10:19:04 +00:00
Merge pull request #200 from victorlevasseur/bugfix/resolution-change-and-fullscreen
Fix Vsync and Max FPS not reactived after a sf::RenderWindow change
This commit is contained in:
@@ -527,7 +527,7 @@ void Project::UnserializeFrom(const SerializerElement & element)
|
||||
SetDefaultHeight(propElement.GetChild("windowHeight", 0, "WindowH").GetValue().GetInt());
|
||||
SetMaximumFPS(propElement.GetChild("maxFPS", 0, "FPSmax").GetValue().GetInt());
|
||||
SetMinimumFPS(propElement.GetChild("minFPS", 0, "FPSmin").GetValue().GetInt());
|
||||
SetVerticalSyncActivatedByDefault(propElement.GetChild("verticalSync").GetValue().GetInt());
|
||||
SetVerticalSyncActivatedByDefault(propElement.GetChild("verticalSync").GetValue().GetBool());
|
||||
#if defined(GD_IDE_ONLY)
|
||||
SetAuthor(propElement.GetChild("author", 0, "Auteur").GetValue().GetString());
|
||||
SetPackageName(propElement.GetStringAttribute("packageName"));
|
||||
|
@@ -277,16 +277,12 @@ void GD_API SetWindowSize( RuntimeScene & scene, int windowWidth, int windowHeig
|
||||
if ( windowWidth == scene.renderWindow->getSize().x && windowHeight == scene.renderWindow->getSize().y )
|
||||
return;
|
||||
|
||||
if ( scene.RenderWindowIsFullScreen() )
|
||||
{
|
||||
scene.renderWindow->create( sf::VideoMode( windowWidth, windowHeight, 32 ), scene.GetWindowDefaultTitle(), sf::Style::Close | sf::Style::Fullscreen );
|
||||
scene.ChangeRenderWindow(scene.renderWindow);
|
||||
}
|
||||
else
|
||||
{
|
||||
scene.renderWindow->create( sf::VideoMode( windowWidth, windowHeight, 32 ), scene.GetWindowDefaultTitle(), sf::Style::Close );
|
||||
scene.ChangeRenderWindow(scene.renderWindow);
|
||||
}
|
||||
|
||||
scene.renderWindow->create(
|
||||
sf::VideoMode( windowWidth, windowHeight, 32 ),
|
||||
scene.GetWindowDefaultTitle(),
|
||||
sf::Style::Close | (scene.RenderWindowIsFullScreen() ? sf::Style::Fullscreen : 0) );
|
||||
scene.ChangeRenderWindow(scene.renderWindow);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@@ -275,7 +275,6 @@ void CppLayoutPreviewer::OnPreviewPlayWindowBtClick( wxCommandEvent & event )
|
||||
externalPreviewWindow = std::shared_ptr<RenderDialog>(new RenderDialog(editor.GetParentControl(), this) );
|
||||
|
||||
externalPreviewWindow->Show(true);
|
||||
externalPreviewWindow->renderCanvas->setFramerateLimit( previewGame.GetMaximumFPS() );
|
||||
|
||||
externalPreviewWindow->SetSizeOfRenderingZone(editor.GetProject().GetMainWindowDefaultWidth(), editor.GetProject().GetMainWindowDefaultHeight());
|
||||
previewScene.ChangeRenderWindow(externalPreviewWindow->renderCanvas);
|
||||
|
@@ -92,6 +92,12 @@ void RuntimeScene::ChangeRenderWindow(sf::RenderWindow * newWindow)
|
||||
if (!renderWindow) return;
|
||||
|
||||
renderWindow->setTitle(GetWindowDefaultTitle());
|
||||
|
||||
if(game)
|
||||
{
|
||||
renderWindow->setFramerateLimit(game->GetMaximumFPS());
|
||||
renderWindow->setVerticalSyncEnabled(game->IsVerticalSynchronizationEnabledByDefault());
|
||||
}
|
||||
SetupOpenGLProjection();
|
||||
}
|
||||
|
||||
|
@@ -174,8 +174,6 @@ int main( int argc, char *p_argv[] )
|
||||
window.create(sf::VideoMode(game.GetMainWindowDefaultWidth(), game.GetMainWindowDefaultHeight(), 32),
|
||||
"", sf::Style::Close);
|
||||
window.setActive(true);
|
||||
window.setFramerateLimit(game.GetMaximumFPS());
|
||||
window.setVerticalSyncEnabled(game.IsVerticalSynchronizationEnabledByDefault());
|
||||
|
||||
//Game main loop
|
||||
bool abort = false;
|
||||
|
Reference in New Issue
Block a user