aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/mgl/graphics/vertex.h4
-rw-r--r--include/mgl/window/window.h14
2 files changed, 18 insertions, 0 deletions
diff --git a/include/mgl/graphics/vertex.h b/include/mgl/graphics/vertex.h
index e4fef34..8cc2f25 100644
--- a/include/mgl/graphics/vertex.h
+++ b/include/mgl/graphics/vertex.h
@@ -14,6 +14,10 @@ typedef struct {
mgl_color color;
} mgl_vertex;
+/*
+ Note: this sends the vertices to the gpu everytime this is called. This should only be used for small lists of vertices
+ or if every vertex needs to change every frame. Use mgl_vertex_buffer instead if possible.
+*/
void mgl_vertices_draw(mgl_context *context, const mgl_vertex *vertices, size_t vertex_count, mgl_primitive_type primitive_type);
#endif /* MGL_VERTEX_H */
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 */