summaryrefslogtreecommitdiffstats
path: root/src/core/frontend
diff options
context:
space:
mode:
authorbunnei <bunneidev@gmail.com>2019-01-08 05:16:01 +0100
committerbunnei <bunneidev@gmail.com>2019-01-24 01:19:23 +0100
commit045b0b70b67b7bc631c69625e6e67a8e8a5c3a58 (patch)
tree872f5d8013e2e0fd3a2f6ecff86b4ad64fbf573d /src/core/frontend
parentMerge pull request #2047 from FearlessTobi/patch-3 (diff)
downloadyuzu-045b0b70b67b7bc631c69625e6e67a8e8a5c3a58.tar
yuzu-045b0b70b67b7bc631c69625e6e67a8e8a5c3a58.tar.gz
yuzu-045b0b70b67b7bc631c69625e6e67a8e8a5c3a58.tar.bz2
yuzu-045b0b70b67b7bc631c69625e6e67a8e8a5c3a58.tar.lz
yuzu-045b0b70b67b7bc631c69625e6e67a8e8a5c3a58.tar.xz
yuzu-045b0b70b67b7bc631c69625e6e67a8e8a5c3a58.tar.zst
yuzu-045b0b70b67b7bc631c69625e6e67a8e8a5c3a58.zip
Diffstat (limited to 'src/core/frontend')
-rw-r--r--src/core/frontend/scope_acquire_window_context.cpp18
-rw-r--r--src/core/frontend/scope_acquire_window_context.h23
2 files changed, 41 insertions, 0 deletions
diff --git a/src/core/frontend/scope_acquire_window_context.cpp b/src/core/frontend/scope_acquire_window_context.cpp
new file mode 100644
index 000000000..3663dad17
--- /dev/null
+++ b/src/core/frontend/scope_acquire_window_context.cpp
@@ -0,0 +1,18 @@
+// Copyright 2019 yuzu Emulator Project
+// Licensed under GPLv2 or any later version
+// Refer to the license.txt file included.
+
+#include "core/frontend/emu_window.h"
+#include "core/frontend/scope_acquire_window_context.h"
+
+namespace Core::Frontend {
+
+ScopeAcquireWindowContext::ScopeAcquireWindowContext(Core::Frontend::EmuWindow& emu_window_)
+ : emu_window{emu_window_} {
+ emu_window.MakeCurrent();
+}
+ScopeAcquireWindowContext::~ScopeAcquireWindowContext() {
+ emu_window.DoneCurrent();
+}
+
+} // namespace Core::Frontend
diff --git a/src/core/frontend/scope_acquire_window_context.h b/src/core/frontend/scope_acquire_window_context.h
new file mode 100644
index 000000000..2d9f6e825
--- /dev/null
+++ b/src/core/frontend/scope_acquire_window_context.h
@@ -0,0 +1,23 @@
+// Copyright 2019 yuzu Emulator Project
+// Licensed under GPLv2 or any later version
+// Refer to the license.txt file included.
+
+#pragma once
+
+#include "common/common_types.h"
+
+namespace Core::Frontend {
+
+class EmuWindow;
+
+/// Helper class to acquire/release window context within a given scope
+class ScopeAcquireWindowContext : NonCopyable {
+public:
+ explicit ScopeAcquireWindowContext(Core::Frontend::EmuWindow& window);
+ ~ScopeAcquireWindowContext();
+
+private:
+ Core::Frontend::EmuWindow& emu_window;
+};
+
+} // namespace Core::Frontend