diff options
Diffstat (limited to 'include/mgl/window/window.h')
-rw-r--r-- | include/mgl/window/window.h | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/include/mgl/window/window.h b/include/mgl/window/window.h index 297ccb9..8e3f626 100644 --- a/include/mgl/window/window.h +++ b/include/mgl/window/window.h @@ -14,12 +14,18 @@ typedef unsigned long mgl_window_handle; typedef struct mgl_window mgl_window; +typedef struct { + mgl_vec2i position; + mgl_vec2i size; +} mgl_view; + struct mgl_window { mgl_window_handle window; GLXContext glx_context; mgl_vec2i size; /* relative to the top left of the window. only updates when the cursor is inside the window */ mgl_vec2i cursor_position; + mgl_view view; }; int mgl_window_create(mgl_window *self, const char *title, int width, int height); @@ -32,4 +38,12 @@ void mgl_window_clear(mgl_window *self, mgl_color color); bool mgl_window_poll_event(mgl_window *self, mgl_event *event); void mgl_window_display(mgl_window *self); +/* + The previous view is returned in |prev_view|. |prev_view| may be NULL. + This should be called every frame to retain the view. + Make sure to set the view back to |prev_view| after rendering items + inside the view. +*/ +void mgl_window_set_view(mgl_window *self, mgl_view *new_view, mgl_view *prev_view); + #endif /* MGL_WINDOW_H */ |