diff options
| author | 2016-08-31 22:20:54 -0400 | |
|---|---|---|
| committer | 2016-08-31 22:20:54 -0400 | |
| commit | 09063dc5bb1e2b769c10077bf820a5300494c119 (patch) | |
| tree | ad997ee86470e23e9dfa67a1d9824a57cdcf5571 /src/citra_qt/bootmanager.cpp | |
| parent | Merge pull request #2035 from MerryMage/disable-stretch (diff) | |
| parent | qt: Rename all "toogle" to "toggle". (diff) | |
| download | yuzu-09063dc5bb1e2b769c10077bf820a5300494c119.tar.gz yuzu-09063dc5bb1e2b769c10077bf820a5300494c119.tar.xz yuzu-09063dc5bb1e2b769c10077bf820a5300494c119.zip | |
Merge pull request #2032 from bunnei/qt-graphics
Qt graphics configure & V-Sync option
Diffstat (limited to 'src/citra_qt/bootmanager.cpp')
| -rw-r--r-- | src/citra_qt/bootmanager.cpp | 59 |
1 files changed, 35 insertions, 24 deletions
diff --git a/src/citra_qt/bootmanager.cpp b/src/citra_qt/bootmanager.cpp index 414b2f8af..6dddde9ba 100644 --- a/src/citra_qt/bootmanager.cpp +++ b/src/citra_qt/bootmanager.cpp | |||
| @@ -107,36 +107,13 @@ private: | |||
| 107 | }; | 107 | }; |
| 108 | 108 | ||
| 109 | GRenderWindow::GRenderWindow(QWidget* parent, EmuThread* emu_thread) : | 109 | GRenderWindow::GRenderWindow(QWidget* parent, EmuThread* emu_thread) : |
| 110 | QWidget(parent), keyboard_id(0), emu_thread(emu_thread) { | 110 | QWidget(parent), keyboard_id(0), emu_thread(emu_thread), child(nullptr) { |
| 111 | 111 | ||
| 112 | std::string window_title = Common::StringFromFormat("Citra | %s-%s", Common::g_scm_branch, Common::g_scm_desc); | 112 | std::string window_title = Common::StringFromFormat("Citra | %s-%s", Common::g_scm_branch, Common::g_scm_desc); |
| 113 | setWindowTitle(QString::fromStdString(window_title)); | 113 | setWindowTitle(QString::fromStdString(window_title)); |
| 114 | 114 | ||
| 115 | keyboard_id = KeyMap::NewDeviceId(); | 115 | keyboard_id = KeyMap::NewDeviceId(); |
| 116 | ReloadSetKeymaps(); | 116 | ReloadSetKeymaps(); |
| 117 | |||
| 118 | // TODO: One of these flags might be interesting: WA_OpaquePaintEvent, WA_NoBackground, WA_DontShowOnScreen, WA_DeleteOnClose | ||
| 119 | QGLFormat fmt; | ||
| 120 | fmt.setVersion(3,3); | ||
| 121 | fmt.setProfile(QGLFormat::CoreProfile); | ||
| 122 | // Requests a forward-compatible context, which is required to get a 3.2+ context on OS X | ||
| 123 | fmt.setOption(QGL::NoDeprecatedFunctions); | ||
| 124 | |||
| 125 | child = new GGLWidgetInternal(fmt, this); | ||
| 126 | QBoxLayout* layout = new QHBoxLayout(this); | ||
| 127 | |||
| 128 | resize(VideoCore::kScreenTopWidth, VideoCore::kScreenTopHeight + VideoCore::kScreenBottomHeight); | ||
| 129 | layout->addWidget(child); | ||
| 130 | layout->setMargin(0); | ||
| 131 | setLayout(layout); | ||
| 132 | |||
| 133 | OnMinimalClientAreaChangeRequest(GetActiveConfig().min_client_area_size); | ||
| 134 | |||
| 135 | OnFramebufferSizeChanged(); | ||
| 136 | NotifyClientAreaSizeChanged(std::pair<unsigned,unsigned>(child->width(), child->height())); | ||
| 137 | |||
| 138 | BackupGeometry(); | ||
| 139 | |||
| 140 | } | 117 | } |
| 141 | 118 | ||
| 142 | void GRenderWindow::moveContext() | 119 | void GRenderWindow::moveContext() |
| @@ -281,6 +258,40 @@ void GRenderWindow::OnClientAreaResized(unsigned width, unsigned height) | |||
| 281 | NotifyClientAreaSizeChanged(std::make_pair(width, height)); | 258 | NotifyClientAreaSizeChanged(std::make_pair(width, height)); |
| 282 | } | 259 | } |
| 283 | 260 | ||
| 261 | void GRenderWindow::InitRenderTarget() { | ||
| 262 | if (child) { | ||
| 263 | delete child; | ||
| 264 | } | ||
| 265 | |||
| 266 | if (layout()) { | ||
| 267 | delete layout(); | ||
| 268 | } | ||
| 269 | |||
| 270 | // TODO: One of these flags might be interesting: WA_OpaquePaintEvent, WA_NoBackground, WA_DontShowOnScreen, WA_DeleteOnClose | ||
| 271 | QGLFormat fmt; | ||
| 272 | fmt.setVersion(3, 3); | ||
| 273 | fmt.setProfile(QGLFormat::CoreProfile); | ||
| 274 | fmt.setSwapInterval(Settings::values.use_vsync); | ||
| 275 | |||
| 276 | // Requests a forward-compatible context, which is required to get a 3.2+ context on OS X | ||
| 277 | fmt.setOption(QGL::NoDeprecatedFunctions); | ||
| 278 | |||
| 279 | child = new GGLWidgetInternal(fmt, this); | ||
| 280 | QBoxLayout* layout = new QHBoxLayout(this); | ||
| 281 | |||
| 282 | resize(VideoCore::kScreenTopWidth, VideoCore::kScreenTopHeight + VideoCore::kScreenBottomHeight); | ||
| 283 | layout->addWidget(child); | ||
| 284 | layout->setMargin(0); | ||
| 285 | setLayout(layout); | ||
| 286 | |||
| 287 | OnMinimalClientAreaChangeRequest(GetActiveConfig().min_client_area_size); | ||
| 288 | |||
| 289 | OnFramebufferSizeChanged(); | ||
| 290 | NotifyClientAreaSizeChanged(std::pair<unsigned, unsigned>(child->width(), child->height())); | ||
| 291 | |||
| 292 | BackupGeometry(); | ||
| 293 | } | ||
| 294 | |||
| 284 | void GRenderWindow::OnMinimalClientAreaChangeRequest(const std::pair<unsigned,unsigned>& minimal_size) { | 295 | void GRenderWindow::OnMinimalClientAreaChangeRequest(const std::pair<unsigned,unsigned>& minimal_size) { |
| 285 | setMinimumSize(minimal_size.first, minimal_size.second); | 296 | setMinimumSize(minimal_size.first, minimal_size.second); |
| 286 | } | 297 | } |