From 4c46bd7916ba692d75c5ee94099151b81695c48e Mon Sep 17 00:00:00 2001 From: dec05eba Date: Tue, 16 Nov 2021 01:41:57 +0100 Subject: Window: add function to check if the window has focus --- include/mgl/window/event.h | 2 ++ include/mgl/window/window.h | 2 ++ 2 files changed, 4 insertions(+) (limited to 'include') diff --git a/include/mgl/window/event.h b/include/mgl/window/event.h index a47568b..f6bf7fd 100644 --- a/include/mgl/window/event.h +++ b/include/mgl/window/event.h @@ -50,6 +50,8 @@ typedef enum { MGL_EVENT_UNKNOWN, MGL_EVENT_CLOSED, /* Window closed */ MGL_EVENT_RESIZED, /* Window resized */ + MGL_EVENT_LOST_FOCUS, + MGL_EVENT_GAINED_FOCUS, MGL_EVENT_TEXT_ENTERED, MGL_EVENT_KEY_PRESSED, MGL_EVENT_KEY_RELEASED, diff --git a/include/mgl/window/window.h b/include/mgl/window/window.h index aa516a8..4bbb46d 100644 --- a/include/mgl/window/window.h +++ b/include/mgl/window/window.h @@ -28,6 +28,7 @@ struct mgl_window { mgl_vec2i cursor_position; mgl_view view; bool open; + bool focused; double frame_time_limit; mgl_clock frame_timer; }; @@ -52,6 +53,7 @@ void mgl_window_set_view(mgl_window *self, mgl_view *new_view); void mgl_window_get_view(mgl_window *self, mgl_view *view); bool mgl_window_is_open(const mgl_window *self); +bool mgl_window_has_focus(const mgl_window *self); bool mgl_window_is_key_pressed(const mgl_window *self, mgl_key key); void mgl_window_close(mgl_window *self); -- cgit v1.2.3