/*-*-c++-*-*/

/* Originally written by Karl.  Julian made some formatting and
   graphics changes 2/3/96 including switching to emacs tab-stops.

   */

import java.lang.*;
import java.awt.*;
import constants;
import scoreboard;

public class terminal extends Frame{
  scoreboard allboards[];
  int numplayers;
  int height=312;
  int width=114;

  public terminal(int p){

    numplayers = p;       //Basic init stuff
    setLayout(null);
    pack();
    allboards = new scoreboard[numplayers];  //Create member scoreboards
    
    switch (numplayers){   //Decide what size we should be, and reshape
    case 1:
      reshape(0,0,16+width,height);
      break;
    case 2:
      reshape(0,0,16+(width*2),height);
      break;
    case 3:
      reshape(0,0,16+(width*3),height);
      break;
    case 4:
      reshape(0,0,16+(width*4),height);
      break;
    case 5:
    case 6:
    case 7:
    case 8:
      reshape(0,0,16+(width*4),(height*2)-50);
      break;
    }

    for (int i = 0; i < numplayers; i++){    //Initialize scoreboards
      if (i < 4){			
	allboards[i] = new scoreboard(i*116,4);
      }
      else{
	allboards[i] = new scoreboard((i-4)*116,304-38);
      }
    }
    
    pack();
    show();
    setResizable(false);        //Don't let em change it
  }

  public void setBoard(int boardnum, scoreboard thisboard){
    allboards[boardnum].setBoard(thisboard);
    repaint();
  }
  
  public void paint(Graphics g){
    for (int i = 0; i < numplayers; i++){
      allboards[i].boardframe.drawYourself(g);
      allboards[i].infoframe.drawYourself(g);
    }
  }
  
  public void update(Graphics g){
    for (int i = 0; i < numplayers; i++){
      allboards[i].drawYourself(g);
    }
  }

}  // End of class Terminal







