package com.ghost.technic;

import com.badlogic.gdx.math.Vector2;
import com.badlogic.gdx.scenes.scene2d.ui.Skin;
import com.badlogic.gdx.scenes.scene2d.ui.Table;
import com.badlogic.gdx.utils.Align;

import java.util.ArrayList;
import java.util.List;

public class HandView extends Table {
    private final List<CardView> cards = new ArrayList<>();

    public HandView(Skin skin) {
        super(skin);
        setBackground("default-round"); // Optional
        setFillParent(false);
        align(Align.bottomLeft);
        pad(10);
    }

    public void addCard(CardView cardView) {
        cards.add(cardView);
        add(cardView).pad(5);
        row();
    }

    public boolean isCardNear(Vector2 cardPos) {
        Vector2 local = stageToLocalCoordinates(cardPos.cpy());
        return hit(local.x, local.y, true) != null;
    }
}
