#pragma once
#include <SDL.h>
#include <map>
#include <unordered_set>
#include <vector>
#include <basetsd.h>

class JoystickInput
{
public:
	void Init();
	void Reset();//关闭所有手柄，再打开所有手柄
	bool GetState(SDL_GameController* pGameController, SDL_GameControllerButtonBind* keyBind, float* outAxis = nullptr);
	std::unordered_set< SDL_GameController*>* GetGameControllerList();
	SDL_GameController* GetFirstGameController();
private:
	bool GetButton(SDL_GameController* pGameController, SDL_GameControllerButton button);
	float GetAxis(SDL_GameController* pGameController, SDL_GameControllerAxis axis);//0负，1正
	std::unordered_set< SDL_GameController*> gameControllerList;//所有的手柄
};

