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

#include "authorscreen.h"

#include "engine/engine.h"
#include "widgets/label_author.h"
#include "audio_effect.h"
#include "engine/locale.h"

AuthorScreen::AuthorScreen() : IScreen ("author") {
    SDL_Log("=> AuthorScreen::AuthorScreen");
    Locale *locale = Locale::getInstance();

    this->setBackgroundColor(0x57,0x74,0xD9);

    auto button_back = new Image(this,16,34,57,32,"button_back_blue.png");
    button_back->setCallback(CallbackType::EVENT_FINGER_UP,[]{
        AudioEffect::click();
        Engine::setActiveScreen("main");
    });

    auto text_author = new Text(this,16,115);
    text_author->setCached(true);
    text_author->setText(locale->tr("Authors"),"inter.ttf",40,{255,255,255});

    author1 = nullptr;
    author2 = nullptr;
}

AuthorScreen::~AuthorScreen() {
    if (author1) delete author1;
    if (author2) delete author2;

}

void AuthorScreen::onActive(const VariantMap &args) {
    if (!author1) {
        author1 = new LabelAuthor(this, 16, 257, "AdmSasha from DanSoft", "(dik@inbox.ru)");
    }

    if (!author2) {
        author2 = new LabelAuthor(this, 16, 356, "Julia Kuznetsova", "(juliaku61@gmail.com)");
    }

}
