mirror of
https://github.com/augustin64/projet-tipe
synced 2025-01-23 23:26:25 +01:00
Improved in-terminal rendering
This commit is contained in:
parent
ecdd93b3b3
commit
b5284230b9
@ -10,18 +10,12 @@ void print_image(unsigned int width, unsigned int height, FILE* ptr, int start)
|
|||||||
fread(buffer, sizeof(buffer), 1, ptr);
|
fread(buffer, sizeof(buffer), 1, ptr);
|
||||||
|
|
||||||
int cur;
|
int cur;
|
||||||
|
char tab[] = {' ', '.', ':', '%', '#', '\0'};
|
||||||
|
|
||||||
for (int i=0; i<height; i++) {
|
for (int i=0; i<height; i++) {
|
||||||
for (int j=0; j<width; j++) {
|
for (int j=0; j<width; j++) {
|
||||||
cur = buffer[start+j+i*width];
|
cur = (int)buffer[start+j+i*width];
|
||||||
if (cur > 150)
|
printf("%c", tab[cur/52]);
|
||||||
printf("0");
|
|
||||||
else {
|
|
||||||
if (cur > 100)
|
|
||||||
printf(".");
|
|
||||||
else
|
|
||||||
printf(" ");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
printf("\n");
|
printf("\n");
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user