aboutsummaryrefslogtreecommitdiff
path: root/src/window
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2021-10-22 07:29:34 +0200
committerdec05eba <dec05eba@protonmail.com>2021-10-22 07:29:34 +0200
commita80bf6bb6cb8ab8c5a1430f9f9dbc214f71bdddf (patch)
treeefcab64abdcfa211020bf4410e12d6182a1c8d90 /src/window
parentc9ee5e1c1feccb073863ba17cbfdcf094f235886 (diff)
Use shader
Diffstat (limited to 'src/window')
-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 };
}