fix: vbuf and non init var

This commit is contained in:
violette 2025-05-02 12:51:50 -04:00
parent 55aee8c40b
commit 805e12f721

7
main.c
View file

@ -17,6 +17,7 @@
#include <float.h>
#include "json.h"
#define VBUF 1
#define SCREEN_WIDTH 80
#define SCREEN_HEIGHT 32
#define CUBE_WIDTH 10
@ -160,7 +161,7 @@ chooseColor(char c)
char
chooseMainFace()
{
int total;
int total = 0;
int faces[NUM_FACES] = {0};
for (int k = 0; k < SCREEN_WIDTH * SCREEN_HEIGHT; ++k)
@ -304,7 +305,7 @@ printCV(char face, struct json_object_element_s *r)
struct json_object_element_s start = *r;
struct json_object_element_s *next = &start;
char k = 0;
char k = 0;
if (face >= 0)
for (; k < face; ++k)
next = next->next;
@ -344,7 +345,9 @@ printAscii(struct json_value_s *json)
for (int k = 0; k < SCREEN_WIDTH * SCREEN_HEIGHT; ++k)
printf("%s", k % SCREEN_WIDTH ? chooseColor(output[k]) : "\r\n");
printf("\r\n");
#ifdef VBUF
fflush(stdout);
#endif
}
void