#ifndef PLAYCANVAS_H
#define PLAYCANVAS_H

#include <qcanvas.h>
#include <qptrlist.h>

#include "level.h"

class QPixmap;
class Bomb;
class Player;
class Blast;
class Item;
class AI_Player;
class Resource;

class PlayCanvas : public QCanvas
{
	Q_OBJECT
public:
	PlayCanvas(QObject *parent = NULL, const char *name = NULL);
	~PlayCanvas();

	enum Events
	{
		moveEvent
	};
	enum Options
	{
		optNone,
		optLeft,
		optRight,
		optDown,
		optUp
	};

	void buildLevel(QString levelfile);
	void drawBackground(void);
	void createMonster(int count = 0);
	bool action(int event, int option);
	bool action_internal(int event, int option);

	void setTheme(QString theme);

	void enable(bool enabled);
	void enableLocal(bool enabled);
	bool enabled();

	void createExit(int x, int y);
	void createItem(int type, int id, int x, int y);
	void createPlayer(int id, int x, int y);

	void removeItem(int id);

	void activateItem(int id);
	void highlightItem(int id);

	Level *level();

signals:
	void information(int lives, int bombs, int power);
	void position(int x, int y);

private:
	Item *findItem(int x, int y);

	Level *m_level;

	QPtrList<Bomb> bombList;
	QPtrList<Item> itemList;
	QPtrList<Blast> blastList;
	QPtrList<Player> playerList;

	Bomb *weapon;
	int weaponcounter;

	Player *currPlayer;
	Resource *resource;
	bool m_away;
	int m_players;
	bool m_enabled;
	bool m_localenabled;

	int m_x, m_y;
};

#endif
