diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/mglpp/graphics/Image.hpp | 1 | ||||
-rw-r--r-- | include/mglpp/graphics/Shader.hpp | 1 | ||||
-rw-r--r-- | include/mglpp/graphics/Text.hpp | 2 | ||||
-rw-r--r-- | include/mglpp/system/FloatRect.hpp | 6 | ||||
-rw-r--r-- | include/mglpp/system/vec.hpp | 3 | ||||
-rw-r--r-- | include/mglpp/window/Event.hpp | 9 |
6 files changed, 16 insertions, 6 deletions
diff --git a/include/mglpp/graphics/Image.hpp b/include/mglpp/graphics/Image.hpp index 1ddeb88..a868ad6 100644 --- a/include/mglpp/graphics/Image.hpp +++ b/include/mglpp/graphics/Image.hpp @@ -19,6 +19,7 @@ namespace mgl { unsigned char* data(); size_t get_byte_size(); vec2i get_size() const; + int get_num_channels() const; mgl_image* internal_image(); private: diff --git a/include/mglpp/graphics/Shader.hpp b/include/mglpp/graphics/Shader.hpp index 47e9689..0aedc47 100644 --- a/include/mglpp/graphics/Shader.hpp +++ b/include/mglpp/graphics/Shader.hpp @@ -20,6 +20,7 @@ namespace mgl { ~Shader(); bool load_from_file(const char *filepath, Type type); + bool set_uniform(const char *name, float value); bool set_uniform(const char *name, vec2f value); bool is_valid() const; diff --git a/include/mglpp/graphics/Text.hpp b/include/mglpp/graphics/Text.hpp index 23f847c..6166087 100644 --- a/include/mglpp/graphics/Text.hpp +++ b/include/mglpp/graphics/Text.hpp @@ -23,7 +23,7 @@ namespace mgl { void set_color(Color color) override; vec2f get_position() const override; - FloatRect get_local_bounds(); + FloatRect get_bounds() const; void set_string(std::string str); const std::string& get_string() const; diff --git a/include/mglpp/system/FloatRect.hpp b/include/mglpp/system/FloatRect.hpp index e187b50..50941dd 100644 --- a/include/mglpp/system/FloatRect.hpp +++ b/include/mglpp/system/FloatRect.hpp @@ -7,10 +7,10 @@ namespace mgl { template <typename T> class Rect { public: - Rect() : position(0.0f, 0.0f), size(0.0f, 0.0f) {} - Rect(const vec2<T>& position, const vec2<T>& size) : position(position), size(size) {} + Rect() : position(0, 0), size(0, 0) {} + Rect(vec2<T> position, vec2<T> size) : position(position), size(size) {} - bool contains(const vec2<T>& point) const { + bool contains(vec2<T> point) const { return point.x >= position.x && point.x <= position.x + size.x && point.y >= position.y && point.y <= position.y + size.y; } diff --git a/include/mglpp/system/vec.hpp b/include/mglpp/system/vec.hpp index ea6eba5..c81cdfa 100644 --- a/include/mglpp/system/vec.hpp +++ b/include/mglpp/system/vec.hpp @@ -4,7 +4,8 @@ namespace mgl { template <typename T> struct vec2 { - vec2(T x = 0, T y = 0) : x(x), y(y) {} + vec2() : x(0), y(0) {} + vec2(T x, T y) : x(x), y(y) {} vec2<T> operator + (vec2<T> other) const { return { x + other.x, y + other.y }; diff --git a/include/mglpp/window/Event.hpp b/include/mglpp/window/Event.hpp index c073251..5b7da45 100644 --- a/include/mglpp/window/Event.hpp +++ b/include/mglpp/window/Event.hpp @@ -15,6 +15,10 @@ namespace mgl { int height; }; + struct TextEvent { + uint32_t codepoint; + }; + struct KeyEvent { Keyboard::Key code; bool alt; @@ -36,7 +40,9 @@ namespace mgl { enum Type : int { Unknown, - Resized, + Closed, /* Window closed */ + Resized, /* Window resized */ + TextEntered, KeyPressed, KeyReleased, MouseButtonPressed, @@ -48,6 +54,7 @@ namespace mgl { union { SizeEvent size; + TextEvent text; KeyEvent key; MouseButtonEvent mouse_button; MouseMoveEvent mouse_move; |