Class Screen

java.lang.Object
  extended byScreen

public class Screen
extends Object

A Screen is a (width*height) grid of (character) 'pixels' on which we may paint various shapes. It can be drawn to a Terminal.

Version:
3

Constructor Summary
Screen(int width, int height)
          Construct a Screen.
 
Method Summary
 void clear()
          Clear the Screen, painting a blank at every pixel.
 void draw(Terminal t)
          Draw this Screen on a Terminal.
 int getHeight()
          How high is this Screen?
 int getWidth()
          How wide is this Screen?
 void paintAt(char c, int x, int y)
          Paint a character pixel at position (x,y).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Screen

public Screen(int width,
              int height)
Construct a Screen.

Parameters:
width - the number of pixels in the x direction.
height - the number of pixels in the y direction.
Method Detail

clear

public void clear()
Clear the Screen, painting a blank at every pixel.


draw

public void draw(Terminal t)
Draw this Screen on a Terminal.

Parameters:
t - the Terminal on which to draw this Screen.

getHeight

public int getHeight()
How high is this Screen?

Returns:
the height.

getWidth

public int getWidth()
How wide is this Screen?

Returns:
the width.

paintAt

public void paintAt(char c,
                    int x,
                    int y)
Paint a character pixel at position (x,y).

Parameters:
c - the character to be painted.
x - the (horizontal) x position.
y - the (vertical) y position.