#include "MenuTextPlayer2JoystickName.h"

void MenuTextPlayer2JoystickName::Step()
{
	if (gameFunc && gameFunc->GetGameControllerName)
	{
		auto isj = gameFunc->GetInputSetting_Player2Joystick();
		auto joy = isj->pGameController;
		if (joy)
		{
			el.flag.text = true;
			ani.png = L"";
			gameFunc->GetGameControllerName(&name, joy);
			if (el.eid != name.data())
				el.eid = name.data();
		}
		else
		{
			el.flag.text = false;
			ani.png = L"menu_CS_title";
			ani.sprite_index = L"joyUnconnected";
		}
	}
}

std::shared_ptr<Entity> CreateMenuTextPlayer2JoystickName()
{
	return std::make_shared<MenuTextPlayer2JoystickName>();
}
