summary refs log tree commit diff
path: root/src/GFX/Window.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/GFX/Window.cpp')
-rw-r--r--src/GFX/Window.cpp18
1 files changed, 16 insertions, 2 deletions
diff --git a/src/GFX/Window.cpp b/src/GFX/Window.cpp
index bbe2ba7..c0c5b03 100644
--- a/src/GFX/Window.cpp
+++ b/src/GFX/Window.cpp
@@ -2,6 +2,8 @@
 #include "../Common/Sizes.hpp"
 #include "Window.hpp"
 
+#include "../Common/Assert.hpp"
+
 namespace MC::GFX {
 
 Window::Window(const Char* title, U32 width, U32 height) {
@@ -48,8 +50,11 @@ Bool Window::mouse(I32 key, I32 type) const {
     return glfwGetMouseButton(m_window, key) == type;
 }
 
-void Window::start_frame() {
+void Window::start_render() {
     glfwSwapBuffers(m_window);
+}
+
+void Window::poll_events() {
     glfwPollEvents();
 }
 
@@ -57,4 +62,13 @@ void Window::on_size_change(void (callback)(GLFWwindow*, I32, I32)) {
     glfwSetFramebufferSizeCallback(m_window, callback);
 }
 
-}
\ No newline at end of file
+void Window::attach() const {
+    glfwMakeContextCurrent(m_window);
+}
+
+void Window::detach() const {
+    ASSERT(glfwGetCurrentContext() == m_window, "Cannot detach window that is not current");
+    glfwMakeContextCurrent(nullptr);
+}
+
+}