package studio.junk.jam.coloritum.ui.components;

import com.badlogic.ashley.core.Component;
import com.badlogic.ashley.core.ComponentMapper;
import com.badlogic.ashley.core.Entity;
import com.badlogic.ashley.core.Family;
import com.badlogic.gdx.math.Vector2;

import studio.junk.jam.coloritum.screen.InGame;

public class Menu implements Component {
	public static final ComponentMapper<Menu> mapper = ComponentMapper.getFor(Menu.class);

	public boolean	visible	= false;
	public double	opacity	= 0f;

	public boolean horizontal = true;

	public final Vector2 position = Vector2.Zero;

	public String id;

	public Menu(String id, boolean horizontal) {
		this.id = id;
		this.horizontal = horizontal;
	}

	@SuppressWarnings("unchecked")
	public static Entity getMenu(String id) {
		for (Entity e : InGame.currentGame.engineUI.getEntitiesFor(Family.all(Menu.class, MenuEntries.class).get())) {
			Menu menu = mapper.get(e);

			if (menu.id.equals(id)) {
				return e;
			}
		}

		return null;
	}
}
