diff options
Diffstat (limited to 'src/core')
| -rw-r--r-- | src/core/CMakeLists.txt | 2 | ||||
| -rw-r--r-- | src/core/frontend/scope_acquire_window_context.cpp | 18 | ||||
| -rw-r--r-- | src/core/frontend/scope_acquire_window_context.h | 23 |
3 files changed, 43 insertions, 0 deletions
diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt index aa9e05089..965c28787 100644 --- a/src/core/CMakeLists.txt +++ b/src/core/CMakeLists.txt | |||
| @@ -95,6 +95,8 @@ add_library(core STATIC | |||
| 95 | frontend/framebuffer_layout.cpp | 95 | frontend/framebuffer_layout.cpp |
| 96 | frontend/framebuffer_layout.h | 96 | frontend/framebuffer_layout.h |
| 97 | frontend/input.h | 97 | frontend/input.h |
| 98 | frontend/scope_acquire_window_context.cpp | ||
| 99 | frontend/scope_acquire_window_context.h | ||
| 98 | gdbstub/gdbstub.cpp | 100 | gdbstub/gdbstub.cpp |
| 99 | gdbstub/gdbstub.h | 101 | gdbstub/gdbstub.h |
| 100 | hle/ipc.h | 102 | hle/ipc.h |
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 @@ | |||
| 1 | // Copyright 2019 yuzu Emulator Project | ||
| 2 | // Licensed under GPLv2 or any later version | ||
| 3 | // Refer to the license.txt file included. | ||
| 4 | |||
| 5 | #include "core/frontend/emu_window.h" | ||
| 6 | #include "core/frontend/scope_acquire_window_context.h" | ||
| 7 | |||
| 8 | namespace Core::Frontend { | ||
| 9 | |||
| 10 | ScopeAcquireWindowContext::ScopeAcquireWindowContext(Core::Frontend::EmuWindow& emu_window_) | ||
| 11 | : emu_window{emu_window_} { | ||
| 12 | emu_window.MakeCurrent(); | ||
| 13 | } | ||
| 14 | ScopeAcquireWindowContext::~ScopeAcquireWindowContext() { | ||
| 15 | emu_window.DoneCurrent(); | ||
| 16 | } | ||
| 17 | |||
| 18 | } // 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 @@ | |||
| 1 | // Copyright 2019 yuzu Emulator Project | ||
| 2 | // Licensed under GPLv2 or any later version | ||
| 3 | // Refer to the license.txt file included. | ||
| 4 | |||
| 5 | #pragma once | ||
| 6 | |||
| 7 | #include "common/common_types.h" | ||
| 8 | |||
| 9 | namespace Core::Frontend { | ||
| 10 | |||
| 11 | class EmuWindow; | ||
| 12 | |||
| 13 | /// Helper class to acquire/release window context within a given scope | ||
| 14 | class ScopeAcquireWindowContext : NonCopyable { | ||
| 15 | public: | ||
| 16 | explicit ScopeAcquireWindowContext(Core::Frontend::EmuWindow& window); | ||
| 17 | ~ScopeAcquireWindowContext(); | ||
| 18 | |||
| 19 | private: | ||
| 20 | Core::Frontend::EmuWindow& emu_window; | ||
| 21 | }; | ||
| 22 | |||
| 23 | } // namespace Core::Frontend | ||