I’m trying to create a card game (which seems more difficult than I thought since there is little to no documentation). Anyway, I’m trying to add cards to a table (which is a widget) and add the cards to a horizontal box (player’s hand). However, whenever I add the image it has the right height but has a completely different width and I can’t seem to change it.
Code to add card:
void AHand::AddCard(ACard* Card)
{
Cards.Add(Card);
UImage* Image = NewObject<UImage>();
const FString CardSuit = StaticEnum<ECardSuitEnum>()->GetValueAsString(Card->CardSuit);
const FString CardRank = StaticEnum<ECardSuitEnum>()->GetValueAsString(Card->CardRank);
FString Path = FString("/Game/Images/CardFront/" + CardSuit + "/" + CardRank);
UTexture2D* Texture = Cast<UTexture2D>(StaticLoadObject(UTexture2D::StaticClass(), NULL, *Path));
Image->SetBrushFromTexture(Texture);
Image->SetBrushSize(FVector2D(700,500));
HandBox->AddChildToHorizontalBox(Image);
}