diff options
author | dec05eba <dec05eba@protonmail.com> | 2021-11-05 21:38:20 +0100 |
---|---|---|
committer | dec05eba <dec05eba@protonmail.com> | 2021-11-05 21:38:20 +0100 |
commit | e2e7c0bf0747d55967c4be6374f3611cd96babb6 (patch) | |
tree | 7267f2086526ac780f57998ff93bae72266e8ddb /include | |
parent | ccb3e58071b3e807109918184727b305df8b96a0 (diff) |
Add bounds calculation to text
Diffstat (limited to 'include')
-rw-r--r-- | include/mgl/gl.h | 3 | ||||
-rw-r--r-- | include/mgl/graphics/image.h | 3 | ||||
-rw-r--r-- | include/mgl/graphics/shader.h | 1 | ||||
-rw-r--r-- | include/mgl/graphics/text.h | 2 |
4 files changed, 7 insertions, 2 deletions
diff --git a/include/mgl/gl.h b/include/mgl/gl.h index 1d19339..fc3ad3c 100644 --- a/include/mgl/gl.h +++ b/include/mgl/gl.h @@ -65,7 +65,8 @@ typedef struct { void (*glUseProgram)(unsigned int program); void (*glAttachShader)(unsigned int program, unsigned int shader); int (*glGetUniformLocation)(unsigned int program, const char *name); - void (*glUniform2fv)(int location, int count, const float *value); + void (*glUniform1f)(int location, float v0); + void (*glUniform2f)(int location, float v0, float v1); unsigned int (*glGetError)(void); const unsigned char* (*glGetString)(unsigned int name); diff --git a/include/mgl/graphics/image.h b/include/mgl/graphics/image.h index 40625bb..d27a755 100644 --- a/include/mgl/graphics/image.h +++ b/include/mgl/graphics/image.h @@ -24,6 +24,7 @@ int mgl_image_load_from_file(mgl_image *self, const char *filepath); int mgl_image_load_from_memory(mgl_image *self, const unsigned char *data, size_t size); void mgl_image_unload(mgl_image *self); -size_t mgl_image_get_size(mgl_image *self); +size_t mgl_image_get_size(const mgl_image *self); +int mgl_image_get_num_channels(const mgl_image *self); #endif /* MGL_IMAGE_H */ diff --git a/include/mgl/graphics/shader.h b/include/mgl/graphics/shader.h index ec89df7..daf8ac3 100644 --- a/include/mgl/graphics/shader.h +++ b/include/mgl/graphics/shader.h @@ -22,6 +22,7 @@ int mgl_shader_program_add_shader_from_file(mgl_shader_program *self, const char int mgl_shader_program_add_shader_from_memory(mgl_shader_program *self, const unsigned char *shader_data, int shader_size, mgl_shader_type shader_type); int mgl_shader_program_finalize(mgl_shader_program *self); +int mgl_shader_program_set_uniform_float(mgl_shader_program *self, const char *uniform_name, float value); int mgl_shader_program_set_uniform_vec2f(mgl_shader_program *self, const char *uniform_name, mgl_vec2f value); /* If |shader_program| is NULL then no shader is used */ diff --git a/include/mgl/graphics/text.h b/include/mgl/graphics/text.h index 9169ab0..f832605 100644 --- a/include/mgl/graphics/text.h +++ b/include/mgl/graphics/text.h @@ -29,6 +29,7 @@ typedef struct { size_t text_size; mgl_color color; mgl_vec2f position; + mgl_vec2f bounds; mgl_text_options options; } mgl_text; @@ -46,6 +47,7 @@ void mgl_text_set_string(mgl_text *self, const char *str, size_t str_size); void mgl_text_set_font(mgl_text *self, mgl_font *font); void mgl_text_set_position(mgl_text *self, mgl_vec2f position); void mgl_text_set_color(mgl_text *self, mgl_color color); +mgl_vec2f mgl_text_get_bounds(const mgl_text *self); void mgl_text_draw(mgl_context *context, mgl_text *text); #endif /* MGL_TEXT_H */ |