net.percederberg.tetris
Class Game

java.lang.Object
  |
  +--net.percederberg.tetris.Game

public class Game
extends java.lang.Object

The Tetris game. This class controls all events in the game and handles all the game logics. The game is started through user interaction with the graphical game component provided by this class.

Version:
1.2
Author:
Per Cederberg, per@percederberg.net

Constructor Summary
Game()
          Creates a new Tetris game.
Game(int width, int height)
          Creates a new Tetris game.
 
Method Summary
 java.awt.Component getComponent()
          Returns a new component that draws the game.
 void quit()
          Kills the game running thread and makes necessary clean-up.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Game

public Game()
Creates a new Tetris game. The square board will be given the default size of 10x20.

Game

public Game(int width,
            int height)
Creates a new Tetris game. The square board will be given the specified size.
Parameters:
width - the width of the square board (in positions)
height - the height of the square board (in positions)
Method Detail

quit

public void quit()
Kills the game running thread and makes necessary clean-up. After calling this method, no further methods in this class should be called. Neither should the component returned earlier be trusted upon.

getComponent

public java.awt.Component getComponent()
Returns a new component that draws the game.
Returns:
the component that draws the game