#include "MySDLInput.h"

MySDLInput::MySDLInput()
{
	keyboard_state = SDL_GetKeyboardState(nullptr);
}

bool MySDLInput::GetKeyBoardState(SDL_Scancode key)
{
	if (keyboard_lock[key])
	{
		//如果该键锁住但没有按下，则释放锁
		if (!keyboard_state[key])
			keyboard_lock[key] = false;
		return false;
	}
	else
		return keyboard_state[key];
}

void MySDLInput::SetKeyLock(SDL_Scancode key)
{
	keyboard_lock[key] = true;
}
