diff options
Diffstat (limited to 'include/mglpp/graphics')
-rw-r--r-- | include/mglpp/graphics/Font.hpp | 16 | ||||
-rw-r--r-- | include/mglpp/graphics/Texture.hpp | 9 |
2 files changed, 16 insertions, 9 deletions
diff --git a/include/mglpp/graphics/Font.hpp b/include/mglpp/graphics/Font.hpp index b032e13..440dabe 100644 --- a/include/mglpp/graphics/Font.hpp +++ b/include/mglpp/graphics/Font.hpp @@ -9,13 +9,14 @@ extern "C" { namespace mgl { class Texture; + class MemoryMappedFile; struct FontGlyph { - vec2f position; - vec2f size; - vec2f texture_position; - vec2f texture_size; - float advance = 0.0f; + vec2i position; + vec2i size; + vec2i texture_position; /* In pixel space */ + vec2i texture_size; /* In pixel space */ + int advance = 0; }; class Font { @@ -23,10 +24,11 @@ namespace mgl { Font(); ~Font(); - bool load_from_file(const char *filepath, unsigned int character_size); + bool load_from_file(const MemoryMappedFile &mapped_file, unsigned int character_size); unsigned int get_character_size() const; // Returns 0 sized glyph if the font doesn't have the codepoint - FontGlyph get_glyph(uint32_t codepoint) const; + FontGlyph get_glyph(uint32_t codepoint); + int get_kerning(uint32_t prev_codepoint, uint32_t codepoint); Texture get_texture() const; mgl_font* internal_font(); diff --git a/include/mglpp/graphics/Texture.hpp b/include/mglpp/graphics/Texture.hpp index 9559829..633d2cd 100644 --- a/include/mglpp/graphics/Texture.hpp +++ b/include/mglpp/graphics/Texture.hpp @@ -11,13 +11,18 @@ namespace mgl { class Image; class Texture { public: + struct LoadOptions { + bool compressed; + bool pixel_coordinates; + }; + Texture(); ~Texture(); static Texture reference(mgl_texture ref); - bool load_from_file(const char *filepath); - bool load_from_image(Image &image); + bool load_from_file(const char *filepath, const LoadOptions load_options = {false, false}); + bool load_from_image(Image &image, const LoadOptions load_options = {false, false}); vec2i get_size() const; bool is_valid() const; |