#pragma once

#include "Singleton.h"

#define DIRECTINPUT_VERSION 0x0800
#include <Dinput.h>

#include <list>


extern HINSTANCE g_hInstance;
extern HWND	g_hWnd;



class InputBase
{
public:
	LPDIRECTINPUTDEVICE8 GetDevice()
	{
		return m_pDevice;
	};

protected:
	InputBase() {};

	LPDIRECTINPUTDEVICE8  m_pDevice;
};


typedef void (*KeyPressedMessageCallback)(int);

class KeyboardInput : public Singleton<KeyboardInput>, public InputBase
{
	friend class Singleton<KeyboardInput>;
private:
		KeyboardInput();

public:

		void Update();
		bool IsPressed(int key);

		KeyboardInput& operator+=(const KeyPressedMessageCallback& fv)
		{
			m_KeyPressedMessages.push_back(fv);
			return *this;
		}

private:
	BYTE  m_diKeys[256]; 
	BYTE  m_LastKeys[256]; 

	std::list<KeyPressedMessageCallback>	m_KeyPressedMessages;
};


class MouseInput : public Singleton<MouseInput>, public InputBase
{
	friend class Singleton<MouseInput>;
private:
		MouseInput();
public:

private:
};
