/***********************************************************************
 * 
 *  G F O ! 
 *  by Chee Chew
 *      and 
 *     Ken Duda 
 *
 *  (c) 1990
 *
 *  This software is free for distribution.  This notice, however, may 
 *  not be altered.
 *  
 *  Enjoy! (and punt... )
 *
 ***********************************************************************/

#include "gfo.h"

void *handle_score_refresh(Game *g, int x, int y, int width, int height)
{
  char score_string[20];

  XClearWindow(g->xc->dsp, g->xc->swin);
  sprintf(score_string,"Score: %d",g->score);
  XDrawString(g->xc->dsp, g->xc->swin, g->xc->sdraw_gc, 15, 30, 
	      score_string, strlen(score_string));
  sprintf(score_string,"Faces: %d",g->faces);
  XDrawString(g->xc->dsp, g->xc->swin, g->xc->sdraw_gc, 15, 65, 
	      score_string, strlen(score_string));
  return NULL;
}

increase_score(Game *g, int n)
{

  g->score = g->score + n + 2 * g->faces;

  handle_score_refresh(g,0,0,0,0);

}


score_block(Game *g, Block *b)
{
  increase_score(g, b->object->length * b->object->width * b->object->depth);
}

score_layer(Game *g, int z)
{
  g->faces++;
  increase_score(g, 10*g->faces);
}

	    
resize_score(Game *g)
{
  XResizeWindow(g->xc->dsp, g->xc->swin, (unsigned int)(g->xc->width*3/16),(unsigned int)(g->xc->height*3/32));
}
