
import java.awt.*;
import java.awt.image.*;

public class Screen extends Canvas
{
private Image offImage;       // buffer for double buffering
private Graphics offGraphics; // buffer for double buffering

public int width;
public int height;

public Color COLOR;
public v3x1  point;
    
private int cx;
private int cy;
    
public Screen(int w, int h)
    {
	width = w;
	height = h;
	cx = (int)(width/2);
	cy = (int)(height/2);
	
	setSize(width, height);
    }

public void update(Graphics g)
    {
	paint(g);
    }
    
public void paint(Graphics g)
    {
	if((offGraphics == null))
	    {
		offImage = createImage(width, height);
		offGraphics = offImage.getGraphics();
		offGraphics.setColor(Color.black);
		offGraphics.fillRect(0, 0, width, height);
	    }

	if(point != null)
	    {
		offGraphics.setColor(COLOR);
		offGraphics.fillOval(cx + (int)(point.x), cy + (int)(point.y), 3, 3);
//		offGraphics.drawLine(cx + (int)(point.x), cy + (int)(point.y),
//				     cx + (int)(point.x), cy + (int)(point.y));
	    }
	
	g.drawImage(offImage, 0, 0, this);
    }
}

