Commit 1e24bd8b8362f0d52a205f252e547a6022ca4416

Thomas de Grivel 2024-02-26T19:19:37

matrix: column center

1
2
3
4
5
6
7
8
9
10
11
12
13
14
diff --git a/libc3/window/sdl2/demo/matrix.c b/libc3/window/sdl2/demo/matrix.c
index f9ac56f..f307bf0 100644
--- a/libc3/window/sdl2/demo/matrix.c
+++ b/libc3/window/sdl2/demo/matrix.c
@@ -199,7 +199,8 @@ bool matrix_text_render (s_sequence *seq, const s_tag *tag, f32 **py)
     *y -= MATRIX_FONT_SIZE;
   mat4_init_identity(&g_ortho.model_matrix);
   printf("y %f\n", *y);
-  mat4_translate(&g_ortho.model_matrix, 0, *y, 0);
+  mat4_translate(&g_ortho.model_matrix,
+                 (MATRIX_FONT_SIZE - text->pt_w) / 2, *y, 0);
   gl_ortho_update_model_matrix(&g_ortho);
   assert(glGetError() == GL_NO_ERROR);
   gl_ortho_color(&g_ortho, 0, 1, 0, 1);