diff --git a/src/main.c b/src/main.c index 2765aad..a2dcfd6 100644 --- a/src/main.c +++ b/src/main.c @@ -1,5 +1,4 @@ #include "../includes/main.h" -#include int main(int argc, char *argv[]) { assert(GL_TRUE == gl4duwCreateWindow(argc, argv, "Othello", 10, 10, 800, @@ -15,8 +14,10 @@ int main(int argc, char *argv[]) { void init(void) { gl4dpInitScreen(); - table = generate_table(gl4dpGetWidth(), gl4dpGetHeight(), (Pos){0, 0}, - RGB(255, 255, 255)); + int padding_title = 80; + + table = generate_table(gl4dpGetWidth(), gl4dpGetHeight() - padding_title, + (Pos){0, 0}, RGB(255, 255, 255)); atexit(quit); } @@ -24,7 +25,7 @@ void init(void) { void quit(void) { free_table(table); } void draw(void) { - gl4dpClearScreen(); + gl4dpClearScreenWith(RGB(0, 0, 0)); job(); gl4dpUpdateScreen(NULL); } diff --git a/src/plateau.c b/src/plateau.c index c170eb1..8968b04 100644 --- a/src/plateau.c +++ b/src/plateau.c @@ -21,6 +21,7 @@ Table *generate_table(GLuint width, GLuint height, Pos origin, Uint32 color) { for (GLuint j = hPas; j < hMax; j += hPas, space_needed += 4) { } } + assert(space_needed != 0); table->lines = malloc(space_needed * sizeof(int)); assert(table->lines != NULL); @@ -39,7 +40,6 @@ Table *generate_table(GLuint width, GLuint height, Pos origin, Uint32 color) { *(tmp + 2) = i; *(tmp + 3) = table->height; } - *(tmp) = -1; return table; } @@ -52,7 +52,7 @@ void free_table(Table *table) { void draw_table(Table *table) { gl4dpSetColor(table->color); - for (int *ptr = table->lines; *(ptr) != -1; ptr += 4) { + for (int *ptr = table->lines; *ptr; ptr += 4) { gl4dpLine(*ptr, *(ptr + 1), *(ptr + 2), *(ptr + 3)); } }