aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/main.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/tests/main.c b/tests/main.c
index 3dc8c98..f76f384 100644
--- a/tests/main.c
+++ b/tests/main.c
@@ -34,9 +34,16 @@ static void draw(mgl_window *window, void *userdata) {
mgl_shader_program_set_uniform_vec2f(u->shader_program, "resolution", (mgl_vec2f){ u->texture->width, u->texture->height });
+ static float rot = 0.0f;
+ rot += 5.0f;
+
mgl_sprite sprite;
- mgl_sprite_init(&sprite, u->texture, 100.0f - 10.0f, 0.0f);
+ mgl_sprite_init(&sprite, u->texture);
+ mgl_sprite_set_position(&sprite, (mgl_vec2f){ 100.0f - 10.0f + u->texture->width * 0.5f * 2.0f, u->texture->height * 0.5f * 2.0f });
mgl_sprite_set_color(&sprite, (mgl_color){255, 255, 255, 128});
+ mgl_sprite_set_rotation(&sprite, rot);
+ mgl_sprite_set_origin(&sprite, (mgl_vec2f){ u->texture->width * 0.5f, u->texture->height * 0.5f });
+ sprite.scale = (mgl_vec2f){ 2.0f, 2.0f };
mgl_shader_program_use(u->shader_program);
mgl_sprite_draw(context, &sprite);
mgl_shader_program_use(NULL);
@@ -213,7 +220,7 @@ int main(int argc, char **argv) {
if(mgl_texture_init(&texture) != 0)
return 1;
- if(mgl_texture_load_from_file(&texture, "tests/X11.jpg", &(mgl_texture_load_options){ false, true }) != 0)
+ if(mgl_texture_load_from_file(&texture, "tests/X11.jpg", &(mgl_texture_load_options){ false, false }) != 0)
return 1;
if(mgl_mapped_file_load("/usr/share/fonts/noto/NotoSans-Regular.ttf", &font_file, &(mgl_memory_mapped_file_load_options){ .readable = true, .writable = false }) != 0)