From c98346545c0e0d0f5d4f242bc0801c82b88fe23c Mon Sep 17 00:00:00 2001 From: Jean Sirmai Date: Wed, 1 Nov 2023 12:07:52 +0100 Subject: [PATCH] =?UTF-8?q?WIP:=20micro-commit=20:=20l'affichage=20est=20O?= =?UTF-8?q?K;=20pr=C3=AAt=20pour=20le=20debug=20du=20graphisme=20(erreur?= =?UTF-8?q?=20simple=20et=20reproductible)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/graphics/arrows.c | 4 ++-- src/graphics/displays.c | 3 ++- src/graphics/graphics.c | 14 ++++++++------ 3 files changed, 12 insertions(+), 9 deletions(-) diff --git a/src/graphics/arrows.c b/src/graphics/arrows.c index b039c58..9fde53b 100644 --- a/src/graphics/arrows.c +++ b/src/graphics/arrows.c @@ -71,11 +71,11 @@ int write_one_arrow_vertex (int space_X_int, int space_Y_int, int space_Z_int, graphics_write_color(0.6f, 0.1f, 0.7f); break; case SOUTH: - graphics_write_vertex (vx, vy, vz + (site % 2 - 1) * (1 / max) - (site % 2 - 1) * arrow_tip_padding, print); + graphics_write_vertex (vx, vy, vz - (site % 2 - 1) * (1 / max) + (site % 2 - 1) * arrow_tip_padding, print); graphics_write_color(0.05f, 0.4f, 1.0f); break; case NORTH: - graphics_write_vertex (vx, vy, vz + (site % 2) * (1 / max) - (site % 2) * arrow_tip_padding, print); + graphics_write_vertex (vx, vy, vz - (site % 2) * (1 / max) + (site % 2) * arrow_tip_padding, print); graphics_write_color(1.0f, 1.0f, 0.0f); break; default: break; diff --git a/src/graphics/displays.c b/src/graphics/displays.c index 394b588..ba3d847 100644 --- a/src/graphics/displays.c +++ b/src/graphics/displays.c @@ -135,6 +135,7 @@ void print_arrows_array (struct arrow_t *arrows, int arrows_nb, int invoked_by) case 4: printf("address == -1 && requested_weight == 0)"); break; case 5: printf("print_user_choices)"); break; case 6: printf("print_evolution)"); break; + case 7: printf("before deletion)"); break; } for (int i = 0; i < arrows_nb; i++) printf("\n [%4d] = %2d | %2d, %2d, %2d, %2d", i, arrows[i].load,\ @@ -154,7 +155,7 @@ void print_user_choices(struct arrow_t *arrows, int max_arrows_nb, int arrows_nb int space_size_x, int space_size_y, int space_size_z, int show_array, int show_space_design) { - printf("model + user constraints :\tspace size x,y,z (%d,%d,%d)\t\tarrows nb : %d > %d\t",\ + printf("model + user constraints :\tspace size x,y,z (%d,%d,%d)\tinitial (max) arrows nb : %d >> %d\t",\ space_size_x, space_size_y, space_size_z, max_arrows_nb, arrows_nb); if (show_space_design) printf(" (grilles alternées)"); diff --git a/src/graphics/graphics.c b/src/graphics/graphics.c index d4decf8..31e9f63 100644 --- a/src/graphics/graphics.c +++ b/src/graphics/graphics.c @@ -679,7 +679,7 @@ static inline int erase_arrow (int arrows_nb, int arrow_address_in_list, if (arrows_nb == 0) assert (buffer_lines_size == buffer_lines_0_arrow); // ? if (arrows_nb == 0) {buffer_lines_size = buffer_lines_0_arrow; return 0;} - if (1) print_arrows_array (arrows_ptr, arrows_nb, 0); + if (1) print_arrows_array (arrows_ptr, arrows_nb, 7); assert (arrows_nb); arrows_nb --; @@ -724,7 +724,7 @@ static inline int erase_arrow (int arrows_nb, int arrow_address_in_list, buffer_colors_origin [buffer_colors_0_arrow + i] = buffer_colors_origin [buffer_colors_size - 6 + i]; } - if (console) print_arrows_array (arrows_ptr, arrows_nb, 0); + if (1) print_arrows_array (arrows_ptr, arrows_nb, 0); return arrows_nb; } @@ -797,9 +797,11 @@ void main_test_graphics (void) rand() % space_Z, // z console); else for (int i = 0; i < 6; i++) - arrows_nb = set_arrow (arrows_ptr, arrows_nb, 1, 1, 1, 1, i, 0, 0, 0, 1); + arrows_nb = set_arrow (arrows_ptr, arrows_nb, 1, 1, 1, 1, i, 0, 0, 0, 0); int max_arrows_nb = arrows_nb; + if (randomize); print_user_choices(arrows_ptr, max_arrows_nb, arrows_nb, space_X, space_Y, space_Z, 0, 0); + if (randomize) for (int i = 0; i < specified_arrows_nb * 6; i++) arrows_nb = set_arrow (arrows_ptr, arrows_nb, space_X, space_Y, space_Z, 0, // load @@ -808,10 +810,10 @@ void main_test_graphics (void) rand() % space_Y, // y rand() % space_Z, // z console); - else for (int i = 0; i < 6; i++) - arrows_nb = set_arrow (arrows_ptr, arrows_nb, 1, 1, 1, 0, i, 0, 0, 0, 1); + else for (int i = 0; i < 1; i++) + arrows_nb = set_arrow (arrows_ptr, arrows_nb, 1, 1, 1, 0, i, 0, 0, 0, 0); - if (randomize || 1) print_user_choices(arrows_ptr, max_arrows_nb, arrows_nb, space_X, space_Y, space_Z, 1, 0); + if (randomize) print_user_choices(arrows_ptr, max_arrows_nb, arrows_nb, space_X, space_Y, space_Z, 1, 0); /*--------------------------------------------------------------------------------*/