/*********************************************************\
		 __      __           __  __
		/ /     / / _____    / / / / ______   __     __
	   / /     / / /___  \  / / / / / ___  | / /    / /
	  / /_____/ / _____| / / / / / / /__/ / / /    / /
	 / ______  / / ___  / / / / / / _____/ / /    / /
	/ /     / / / /__/ / / / / / / |____  / |____/ /
   /_/     /_/ |______/ /_/ /_/  \_____/  \_____  /
										 ______/ /
			High Level Game Framework   /_______/

  ------------------------------------------------------

  Copyright (c) 2007 - Rodrigo Braz Monteiro.
  This file is subject to the terms of license.txt.

\*********************************************************/

#pragma once

#include "input_keyboard.h"
#include "input_joystick.h"
#include "input_mouse.h"
#include "input_virtual.h"

namespace Halley {

	class Input {
	public:
		static spInputKeyboard getKeyboard(int id=0);
		static spInputJoystick getJoystick(int id=0);
		static spInputJoystick getFirstJoystick();
		static spInputMouse getMouse(int id=0);
		static size_t getNumberOfKeyboards();
		static size_t getNumberOfJoysticks();
		static size_t getNumberOfMice();

		static void beginEvents();
		static void processEvent(SDL_Event& event);

	private:
		Input();

		static void processJoyEvent(int n, SDL_Event& event);

		static shared_ptr<Input> instance;

		std::vector<spInputKeyboard> keyboards;
		std::vector<spInputJoystick> joysticks;
		std::vector<spInputMouse> mice;

		std::map<int, spInputJoystick> sdlJoys;

		friend class Game;
	};

	typedef shared_ptr<Input> spInput;

};
