aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/mglpp/graphics/Font.hpp4
-rw-r--r--include/mglpp/graphics/Image.hpp3
-rw-r--r--include/mglpp/graphics/Shader.hpp32
-rw-r--r--include/mglpp/window/Window.hpp4
4 files changed, 37 insertions, 6 deletions
diff --git a/include/mglpp/graphics/Font.hpp b/include/mglpp/graphics/Font.hpp
index af70115..6818277 100644
--- a/include/mglpp/graphics/Font.hpp
+++ b/include/mglpp/graphics/Font.hpp
@@ -1,8 +1,6 @@
#ifndef MGLPP_FONT_HPP
#define MGLPP_FONT_HPP
-#include <string>
-
extern "C" {
#include <mgl/graphics/font.h>
}
@@ -13,7 +11,7 @@ namespace mgl {
Font();
~Font();
- bool load_from_file(const std::string &filepath, unsigned int character_size);
+ bool load_from_file(const char *filepath, unsigned int character_size);
unsigned int get_character_size() const;
mgl_font* internal_font();
diff --git a/include/mglpp/graphics/Image.hpp b/include/mglpp/graphics/Image.hpp
index 2f7aed5..fd82c0c 100644
--- a/include/mglpp/graphics/Image.hpp
+++ b/include/mglpp/graphics/Image.hpp
@@ -1,7 +1,6 @@
#ifndef MGLPP_IMAGE_HPP
#define MGLPP_IMAGE_HPP
-#include <string>
#include "../system/vec.hpp"
extern "C" {
@@ -14,7 +13,7 @@ namespace mgl {
Image();
~Image();
- bool load_from_file(const std::string &filepath);
+ bool load_from_file(const char *filepath);
unsigned char* data();
size_t get_byte_size();
vec2i get_size() const;
diff --git a/include/mglpp/graphics/Shader.hpp b/include/mglpp/graphics/Shader.hpp
new file mode 100644
index 0000000..4e94a7e
--- /dev/null
+++ b/include/mglpp/graphics/Shader.hpp
@@ -0,0 +1,32 @@
+#ifndef MGLPP_SHADER_HPP
+#define MGLPP_SHADER_HPP
+
+#include "../system/vec.hpp"
+
+extern "C" {
+#include <mgl/graphics/shader.h>
+}
+
+namespace mgl {
+ class Shader {
+ public:
+ enum Type {
+ Vertex,
+ Fragment,
+ Geometry
+ };
+
+ Shader();
+ ~Shader();
+
+ bool load_from_file(const char *filepath, Type type);
+ bool set_uniform(const char *name, vec2f value);
+
+ // If |shader| is nullptr then no shader is used
+ static void use(Shader *shader);
+ private:
+ mgl_shader_program shader_program;
+ };
+}
+
+#endif /* MGLPP_SHADER_HPP */
diff --git a/include/mglpp/window/Window.hpp b/include/mglpp/window/Window.hpp
index 916e891..d98f5ef 100644
--- a/include/mglpp/window/Window.hpp
+++ b/include/mglpp/window/Window.hpp
@@ -13,6 +13,7 @@ namespace mgl {
class Event;
class Drawable;
+ class Shader;
class Window {
public:
@@ -28,9 +29,10 @@ namespace mgl {
bool create(const char *title, int width, int height);
bool poll_event(Event &event);
void clear(mgl::Color color = mgl::Color(0, 0, 0, 255));
- void draw(Drawable &drawable);
+ void draw(Drawable &drawable, Shader *shader = nullptr);
void display();
+ vec2i get_size() const;
vec2i get_cursor_position() const;
private:
mgl_window window;