Class TBoard

java.lang.Object
   |
   +----java.awt.Component
           |
           +----java.awt.Canvas
                   |
                   +----Board
                           |
                           +----TBoard

class TBoard
extends Board
TBoard TicTacToe Board
 this file is designed to be an example for creating games for jGames
 -the comment "DNR" (do not remove) means that this method or variable 
  musn't be removed but should be changed to fit the game you are coding
 -the comment "DNC" (do not change) means that this method or variable
  must be there and left as it's.
-
-
 if TBoard is an extension of Board it's because I included some "tools"
 in Board that are usefull to build a game, and like this, there is no 
 need to rewrite or copy those methods.
 * tool list
 * hidden tools
 1- Board do the translation between absolut coordinates and image
    like this you don't have to bother about the position of your board.
    (see tW(),tH(), mouseDown() and paint() )
 2- Board do all the double buffering thing which avoid the image to
    flicker. 
    (see update() and paint())
-
 * not hidden tool
 getImage(String name) will return you an image from the directory where
  the applet was downloaded
 

Version:
1.0b1 25/04/98

Variable Index

 o crossd
this is the width of a cross picture divided by 2
 o horizBoard
if you want the Board to be horizontal set this to true
 o myH
heigth of the board
 o myW
width of the board (in this case width of the picture I use)
 o picts
the array in which I'll store images 0 for background 1 for player's crosses 2 for opponent crosses
 o tab
Array that gives the start board

Constructor Index

 o TBoard()
Constructror

Method Index

 o getClickValue(int, int)
This method is called by mouseDown() each time a bol is clicked.
 o init(Gpanel)
initialization of the Board this method is called only once, at the start of the Game.
 o paintBoard(Graphics)
this method is each time the player receive a new array representing the game Board.

Variables

 o tab
 int tab[]
Array that gives the start board

 o myW
 int myW
width of the board (in this case width of the picture I use)

 o myH
 int myH
heigth of the board

 o horizBoard
 boolean horizBoard
if you want the Board to be horizontal set this to true

 o crossd
 int crossd
this is the width of a cross picture divided by 2

 o picts
 Image picts[]
the array in which I'll store images 0 for background 1 for player's crosses 2 for opponent crosses

Constructors

 o TBoard
 public TBoard()
Constructror

Methods

 o init
 public void init(Gpanel o)
initialization of the Board this method is called only once, at the start of the Game.

Overrides:
init in class Board
 o paintBoard
 public void paintBoard(Graphics gr)
this method is each time the player receive a new array representing the game Board. this is where you draw a new board. gr is the Graphics on which you will draw, it's automgically double buffered and centered on the player's Frame

Overrides:
paintBoard in class Board
 o getClickValue
 public void getClickValue(int xC,
                           int yC)
This method is called by mouseDown() each time a bol is clicked. It determine on which square the player clicked, and gives the position in the array of this clicked square to owner.play() . xC and yC represents the coordinates in the Image you draw in paintBoard(Graphics gr);

Overrides:
getClickValue in class Board