From 45e509ea8d21bf45df09deecc2e5a2f09751667b Mon Sep 17 00:00:00 2001 From: dec05eba Date: Sat, 7 Jan 2023 13:37:15 +0100 Subject: Window: add functions to set fullscreen state, vsync state --- depends/mgl | 2 +- include/mglpp/window/Window.hpp | 4 ++++ src/window/Window.cpp | 16 ++++++++++++++++ 3 files changed, 21 insertions(+), 1 deletion(-) diff --git a/depends/mgl b/depends/mgl index eb7bb70..c601753 160000 --- a/depends/mgl +++ b/depends/mgl @@ -1 +1 @@ -Subproject commit eb7bb70749079490da090a5ad01fd4546195378e +Subproject commit c6017539ea7caa1db88040f96b3352f15f7b02b9 diff --git a/include/mglpp/window/Window.hpp b/include/mglpp/window/Window.hpp index b4975b4..2ba61ff 100644 --- a/include/mglpp/window/Window.hpp +++ b/include/mglpp/window/Window.hpp @@ -70,6 +70,10 @@ namespace mgl { void set_title(const char *title); // 0 = no fps limit, or limit fps to vsync if vsync is enabled void set_framerate_limit(unsigned int fps); + void set_vsync_enabled(bool enabled); + bool is_vsync_enabled() const; + void set_fullscreen(bool fullscreen); + bool is_fullscreen() const; void set_key_repeat_enabled(bool enabled); void set_cursor_visible(bool visible); vec2i get_size() const; diff --git a/src/window/Window.cpp b/src/window/Window.cpp index 64ee9fe..512991a 100644 --- a/src/window/Window.cpp +++ b/src/window/Window.cpp @@ -93,6 +93,22 @@ namespace mgl { mgl_window_set_framerate_limit(&window, fps); } + void Window::set_vsync_enabled(bool enabled) { + mgl_window_set_vsync_enabled(&window, enabled); + } + + bool Window::is_vsync_enabled() const { + return mgl_window_is_vsync_enabled(&window); + } + + void Window::set_fullscreen(bool fullscreen) { + mgl_window_set_fullscreen(&window, fullscreen); + } + + bool Window::is_fullscreen() const { + return mgl_window_is_fullscreen(&window); + } + void Window::set_key_repeat_enabled(bool enabled) { mgl_window_set_key_repeat_enabled(&window, enabled); } -- cgit v1.2.3