//
// Created by sasha on 27.11.2025.
//

#include "button_level.h"

#include "engine/widgets/image.h"
#include "engine/widgets/text.h"
#include "engine/locale.h"

ButtonLevel::ButtonLevel(IWidget *parent, float x, float y, const std::string &type) : IWidget (parent, x,y,328,90) {
    Locale *locale = Locale::getInstance();

    std::string filename = "button_level_easy.png";
    std::string text = locale->tr("Easy");
    std::string desc = locale->tr("A quick game");
    SDL_Color desc_color{0x8B,0xEC,0xAA};

    if (type == "normal"){
        filename = "button_level_normal.png";
        text = locale->tr("Normal");
        desc = locale->tr("Classic");
        desc_color = {0x8B,0x89,0xFF};
    }

    if (type == "hard"){
        filename = "button_level_hard.png";
        text = locale->tr("Hard");
        desc = locale->tr("Challenge");
        desc_color = {0xFF,0x92,0x88};
    }

    button_image = new Image(parent,x,y,328,90,filename);

    text1 = new Text(parent,x+23,y+25.5);
    text1->setCached(true);
    text1->setText(text,"inter.ttf",18,{255,255,255});

    text2 = new Text(parent,x+23,text1->getFRect().y+text1->getFRect().h+2);
    text2->setCached(true);
    text2->setText(desc,"inter.ttf",12,desc_color);
}

ButtonLevel::~ButtonLevel() {

}
