/* CVS: $Id: PaintTest.java,v 1.11 2001/03/17 11:47:07 gvijf Exp $ */

package gui;

import javax.swing.*;
import java.awt.event.*;

import evolution.WorldController;
import evolution.InfoList;

/**
 * This is a testing class for the paint methods.
 */
public class PaintTest extends JFrame {

    public PaintTest(WorldController worldController) {
        super("PaintTest");
        this.worldController = worldController;
        init();
        setSize(200, 200);
        pack();
        show();
        worldController.startGame();
        try {
            worldController.createHuman();
            worldController.selectSquareOfLand(3, 2);
        } catch(Exception e) {
            System.out.println(e);
        }

        System.out.println("ACTIONS");
        InfoList actions = worldController.getActionsInfo();
        while(actions.next())
            System.out.println(actions.getName());
        System.out.println("RESOURCES");
        InfoList resources = worldController.getResourcesInfo();
        while(resources.next())
            System.out.println(resources.getName() + ":" + resources.getString());
        InfoList constructions = worldController.getConstructionsInfo();
        System.out.println("CONSTRUCTIONS");
        while(constructions.next())
            System.out.println(constructions.getName());

        addWindowListener(new WindowAdapter() {
            public void windowClosing(WindowEvent e) {
                System.exit(0);
            }
        });
    }

    protected void init() {
        gameBoard = new GameBoard(worldController);
        sp = new JScrollPane(gameBoard);
        getContentPane().add(sp);
    }

    public static void main(String args[]) throws Exception {
        new PaintTest(new WorldController("resources/evolution.prop", 10, 10)).show();
    }

    private WorldController worldController;

    private JScrollPane sp;
    private GameBoard gameBoard;

}
