#ifndef GAMEGRID_INCLUDE_H
#define GAMEGRID_INCLUDE_H

#include <PocketFrog/PocketFrog.h>

using namespace Frog;

class GameGrid
{
private:
	// puntatore alla surface da usare
	Surface *surf;

	// matrice bidimensionale di celle
	typedef struct _CELL {
		int cellIndex;
	} CELL;
	CELL ***CELLS;
	int COLS, ROWS, CELLWIDTH, CELLHEIGHT;
	
	int WORLDX, WORLDY;

	void _FillGrid(int cellindex, int x1, int y1, int x2, int y2);

	// cella in alto a sinistra (ricalcolata ogni volta che setti le coordinate del mondo)
	int STARTCOL, STARTROW, COLOFFSET, ROWOFFSET;

public:
	GameGrid(Surface *surf, int cols, int rows, int cellwidth, int cellheight);
	~GameGrid(void);
	void ClearGrid(int index);
	bool SetCell(int col, int row, int index);
	int GetCell(int col, int row);
	void draw(Display *display, int x, int y, int width, int height);

	void FillGrid(int cellindex);
	void FillGrid(int cellindex, int x1, int y1, int x2, int y2);

	int WorldX();
	int WorldY();
	void WorldX(int x);
	void WorldY(int y);
};

#endif
