- Calcula el percentatge de cobertura
This commit is contained in:
11
main.c
11
main.c
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user