aboutsummaryrefslogtreecommitdiff
path: root/src/window/Window.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/window/Window.cpp')
-rw-r--r--src/window/Window.cpp11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/window/Window.cpp b/src/window/Window.cpp
index bc1f5ac..79e015b 100644
--- a/src/window/Window.cpp
+++ b/src/window/Window.cpp
@@ -1,6 +1,7 @@
#include "../../include/mglpp/window/Window.hpp"
#include "../../include/mglpp/window/Event.hpp"
#include "../../include/mglpp/graphics/Drawable.hpp"
+#include "../../include/mglpp/graphics/Shader.hpp"
extern "C" {
#include <mgl/window/event.h>
@@ -36,9 +37,13 @@ namespace mgl {
mgl_window_clear(&window, mgl_color{color.r, color.g, color.b, color.a});
}
- void Window::draw(Drawable &drawable) {
+ void Window::draw(Drawable &drawable, Shader *shader) {
// TODO: Make the opengl context active for this thread and window, if it already isn't
+ if(shader)
+ mgl::Shader::use(shader);
drawable.draw(*this);
+ if(shader)
+ mgl::Shader::use(nullptr);
}
void Window::display() {
@@ -47,6 +52,10 @@ namespace mgl {
mgl_window_display(&window);
}
+ vec2i Window::get_size() const {
+ return { window.size.x, window.size.y };
+ }
+
vec2i Window::get_cursor_position() const {
return { window.cursor_position.x, window.cursor_position.y };
}