erland.game.tetris
Interface BlockMatrix

All Known Implementing Classes:
BlockContainerData

interface BlockMatrix

Represents a container with squares, where each square may be (active/not active) and each square also has a colour

Author:
Erland Isaksson

Method Summary
 java.awt.Color getColor(int x, int y)
          Get the color of a specific square
 int getHeight()
          Get the number of vertical squares in the container
 int getWidth()
          Get the number of horisontal squares in the container
 boolean isUsed(int x, int y)
          Checks if a specific square is active or not
 void setUnused(int x, int y)
          Change the state to not active for a specific square
 void setUsed(int x, int y, java.awt.Color c)
          Change the state to active for a specific square
 

Method Detail

getWidth

public int getWidth()
Get the number of horisontal squares in the container

Returns:
Number of horisontal squares

getHeight

public int getHeight()
Get the number of vertical squares in the container

Returns:
Number of vertical squares

getColor

public java.awt.Color getColor(int x,
                               int y)
Get the color of a specific square

Parameters:
x - The x position of the square
y - The y position of the square
Returns:
The color of the square, Color.black if it is outside the container

isUsed

public boolean isUsed(int x,
                      int y)
Checks if a specific square is active or not

Parameters:
x - The x position of the square
y - The y position of the square
Returns:
true/false (active/not active)

setUsed

public void setUsed(int x,
                    int y,
                    java.awt.Color c)
Change the state to active for a specific square

Parameters:
x - The x position of the square
y - The y position of the square
c - The colour of the square

setUnused

public void setUnused(int x,
                      int y)
Change the state to not active for a specific square

Parameters:
x - The x position of the square
y - The y position of the square


Copyright © 2003-2004 Erland Isaksson. All Rights Reserved.