From b8a489a6ec685fc021db75957fd6e5fd22db183f Mon Sep 17 00:00:00 2001 From: floralrainfall Date: Sun, 16 Jul 2023 01:57:42 -0400 Subject: [PATCH] force_enable_vsync fix --- Projects/Client/CMakeLists.txt | 4 ++++ Projects/Client/Common/Source/OgreWidget.cpp | 3 +++ Projects/Client/Studio/CMakeLists.txt | 5 +---- Projects/Client/Studio/Source/MainWindow.cpp | 1 + 4 files changed, 9 insertions(+), 4 deletions(-) diff --git a/Projects/Client/CMakeLists.txt b/Projects/Client/CMakeLists.txt index 74c8af2..0c8ceb0 100644 --- a/Projects/Client/CMakeLists.txt +++ b/Projects/Client/CMakeLists.txt @@ -13,6 +13,10 @@ if(COMPILE_PLAYER OR COMPILE_STUDIO) add_subdirectory(Common) + if(FORCE_ENABLE_VSYNC) + target_compile_definitions(Common PUBLIC FORCE_ENABLE_VSYNC) + endif() + if(COMPILE_PLAYER) add_subdirectory(Player) endif() diff --git a/Projects/Client/Common/Source/OgreWidget.cpp b/Projects/Client/Common/Source/OgreWidget.cpp index 37da982..2aa334a 100644 --- a/Projects/Client/Common/Source/OgreWidget.cpp +++ b/Projects/Client/Common/Source/OgreWidget.cpp @@ -119,6 +119,9 @@ namespace RNR options["externalWindowHandle"] = getWindowHandle(); options["FSAA"] = "4"; +#ifdef FORCE_ENABLE_VSYNC + options["vsync"] = "true"; +#endif #if OGRE_PLATFORM == OGRE_PLATFORM_APPLE options["macAPI"] = "cocoa"; options["macAPICocoaUseNSView"] = "true"; diff --git a/Projects/Client/Studio/CMakeLists.txt b/Projects/Client/Studio/CMakeLists.txt index 457e17c..9950e48 100644 --- a/Projects/Client/Studio/CMakeLists.txt +++ b/Projects/Client/Studio/CMakeLists.txt @@ -16,12 +16,9 @@ if(WIN32) list(APPEND HEADER Resource/Windows/Script.rc) endif() -if(FORCE_ENABLE_VSYNC) - target_compile_definitions(Studio PRIVATE FORCE_ENABLE_VSYNC) -endif() - qt_add_executable(Studio ${SOURCE} ${HEADER}) + target_include_directories(Studio PRIVATE Header) target_link_libraries(Studio PRIVATE Common Engine) diff --git a/Projects/Client/Studio/Source/MainWindow.cpp b/Projects/Client/Studio/Source/MainWindow.cpp index 2ef364e..ae57b2e 100644 --- a/Projects/Client/Studio/Source/MainWindow.cpp +++ b/Projects/Client/Studio/Source/MainWindow.cpp @@ -13,6 +13,7 @@ MainWindow::MainWindow() ogreRoot = new Ogre::Root(); Ogre::ConfigDialog* config = OgreBites::getNativeConfigDialog(); ogreRoot->showConfigDialog(config); + ogreRoot->initialise(false); menubar = new QMenuBar();