//
// Created by sasha on 01.12.2025.
//

#include "button_victory.h"

ButtonVictory::ButtonVictory(IWidget *parent,float x, float y, const std::string &text,const std::string &type): IWidget (parent,x,y,132,56) {

    std::string filename = "victory_button_replay_green.png";

    if (type=="normal"){
        filename="victory_button_replay_blue.png";
    }
    if (type=="hard"){
        filename="victory_button_replay_red.png";
    }

    image = new Image(this, x,y,132,56,filename);

    description = new Text(this, image->getFRect().x+20,image->getFRect().y+18.5);
    description->setCached(true);
    description->setText(text,"inter.ttf",20,{255,255,255});
    description->move(image->getFRect().x+(image->getFRect().w-description->getFRect().w)/2,description->getFRect().y);
}

ButtonVictory::~ButtonVictory() {
    delete image;
    delete description;
}

void ButtonVictory::setType(const std::string &type) {
    std::string filename = "victory_button_replay_green.png";

    if (type=="normal"){
        filename="victory_button_replay_blue.png";
    }
    if (type=="hard"){
        filename="victory_button_replay_red.png";
    }
    image->setTexture(filename);
}
