#import <appkit/appkit.h>
#import "ResponseMeter.h"

#import "gnuchess.h"

@implementation ResponseMeter

- displayFilled
{
  [self lockFocus];
  PSgsave();

  PSsetgray( NX_WHITE );
  PSclippath();
  PSfill();

  PSsetlinewidth( 2.0 );
  PSsetgray( NX_BLACK );
  PSclippath();
  PSstroke();
  
  PSgrestore();
  
  PSflushgraphics();
  NXPing();
  
  [self unlockFocus];
}

- drawSelf:(const NXRect *)f :(int)rectCount
{
  PSgsave();
  PSsetgray( 0.5 );
  PSclippath();
  PSfill();

  if( (ResponseTime+ExtraTime) ){  
    PSsetgray( NX_WHITE );
    PSrectfill( 0.0, 0.0, 
                et*(f->size.width/(ResponseTime+ExtraTime)), f->size.height );
  }
  
  PSsetlinewidth( 2.0 );
  PSsetgray( NX_BLACK );
  PSclippath();
  PSstroke();
  
  PSgrestore();
}

@end
  
