mirror of
https://github.com/shawns-valve/halflife.git
synced 2024-11-25 05:31:11 +00:00
35 lines
443 B
C
35 lines
443 B
C
|
/*
|
||
|
meter.c
|
||
|
|
||
|
Implements a dorky progess meter
|
||
|
*/
|
||
|
|
||
|
int showmeter = 0;
|
||
|
static int meter_cur, meter_max;
|
||
|
|
||
|
void MeterStart( int max )
|
||
|
{
|
||
|
meter_cur = 0;
|
||
|
meter_max = max;
|
||
|
}
|
||
|
|
||
|
|
||
|
void MeterAdvance( int amt )
|
||
|
{
|
||
|
float pct;
|
||
|
|
||
|
meter_cur += amt;
|
||
|
|
||
|
if( showmeter )
|
||
|
{
|
||
|
pct = ( (float) meter_cur / (float) meter_max ) * 100.0;
|
||
|
printf( "\r%d/%d (%0.2f%%) ", meter_cur, meter_max, pct );
|
||
|
}
|
||
|
}
|
||
|
|
||
|
|
||
|
void MeterEnd( void )
|
||
|
{
|
||
|
printf( "\n" );
|
||
|
}
|