// Decompiled by DJ v3.0.0.63 Copyright 2002 Atanas Neshkov  Date: 11/09/2002 17:31:20
// Home Page : http://members.fortunecity.com/neshkov/dj.html  - Check often for new version!
// Decompiler options: packimports(3) 
// Source File Name:   GameAnimator.java

import java.awt.*;

public class GameAnimator extends Canvas
    implements Runnable
{

    public GameAnimator(Image aimage[], int i, int j, int k, int l, Color color)
    {
        frames = aimage;
        numFrames = aimage.length;
        displaySize = new Dimension(i, j);
        delay = k;
        pause = l;
        background = color;
    }

    public void run()
    {
        try
        {
            animate();
            return;
        }
        catch(Exception exception)
        {
            exception.printStackTrace();
        }
    }

    public void join(int i)
    {
        try
        {
            Thread.currentThread().join(i);
            return;
        }
        catch(InterruptedException _ex)
        {
            return;
        }
    }

    private void animate()
    {
        try
        {
            for(; currentFrame < numFrames; currentFrame++)
            {
                paint(getGraphics());
                Thread.currentThread();
                Thread.sleep(delay);
            }

            Thread.currentThread();
            Thread.sleep(pause);
            return;
        }
        catch(InterruptedException _ex)
        {
            Thread.currentThread().interrupt();
        }
    }

    public void update(Graphics g)
    {
        if(currentFrame >= numFrames)
        {
            return;
        } else
        {
            g.drawImage(frames[currentFrame], 0, 0, displaySize.width, displaySize.height, background, this);
            return;
        }
    }

    public void paint(Graphics g)
    {
        update(g);
    }

    private Image frames[];
    private int numFrames;
    private Dimension displaySize;
    private int delay;
    private int currentFrame;
    private int pause;
    Color background;
}