//	GameState.h - Base class for the various game states.
//  ----------------------------------------------------------------------------
//	This file is part of 'CavernsOfLight', a game.
//	Copyright (C) 2009  Niall Moody
//	
//	This program is free software: you can redistribute it and/or modify
//	it under the terms of the GNU General Public License as published by
//	the Free Software Foundation, either version 3 of the License, or
//	(at your option) any later version.
//
//	This program is distributed in the hope that it will be useful,
//	but WITHOUT ANY WARRANTY; without even the implied warranty of
//	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//	GNU General Public License for more details.
//
//	You should have received a copy of the GNU General Public License
//	along with this program.  If not, see <http://www.gnu.org/licenses/>.
//	----------------------------------------------------------------------------

#ifndef GAMESTATE_H_
#define GAMESTATE_H_

#include "SDL.h"
#include <string>
#include <map>

class Drawer;
class Application;

///	Base class for the various game states.
class GameState
{
  public:
	///	Constructor.
	GameState(Application *app);
	///	Destructor.
	virtual ~GameState();

	///	Draws the current state.
	virtual void draw(Drawer *d) = 0;

	///	Called when a key down event is received.
	virtual void keyDown(const SDL_keysym& keyPressed) {};
	///	Called when a key up event is received.
	virtual void keyUp(const SDL_keysym& keyPressed) {};

	///	Called when a mouse down event is received.
	virtual void mouseDown(int button, int posX, int posY) {};
	///	Called when a mouse up event is received.
	virtual void mouseUp(int button, int posX, int posY) {};
	///	Called when a mouse move event is received.
	virtual void mouseMove(int posX, int posY) {};

	///	Returns the name of this state.
	virtual const std::string getName() const = 0;
  protected:
	///	Used by subclasses to tell Application to move to the next state.
	/*!
		\param state The state to move to.
	 */
	void nextState(const std::string state);
	///	Used by subclasses to tell Application to quit.
	void quit();
  private:
	///	The main Application instance for the game.
	Application *application;
};

#endif
