- Calcula el percentatge de cobertura

This commit is contained in:
2023-11-22 16:41:36 +01:00
parent c5e722fabc
commit 2becdd1835

11
main.c
View File

@@ -106,6 +106,15 @@ void fill_sector(int fill)
}
}
int get_percent()
{
int claimed = 0;
for (int y=0;y<200;++y)
for (int x=0;x<200;++x)
if (pixels[x+y*200]!=0) claimed++;
return (claimed*100)/(200*200);
}
void close_sector()
{
SDL_SetRenderTarget(ren, tex);
@@ -128,6 +137,8 @@ void close_sector()
if (sector2>sector1) fill_sector(254); else fill_sector(255);
}
printf("%i...\n", get_percent());
SDL_SetRenderTarget(ren, NULL);
}