#include "MenuTextJoystick2Name.h"

void MenuTextJoystick2Name::Step()
{
	if (gameFunc && gameFunc->GetGameControllerName && gameFunc->GetGameControllerFromIndex)
	{
		auto joy = gameFunc->GetGameControllerFromIndex(1);
		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"joy2Unconnected";
		}

	}
}

std::shared_ptr<Entity> CreateMenuTextJoystick2Name()
{
	return std::make_shared<MenuTextJoystick2Name>();
}
