/*
 * MIT License
 * Author: Mark Allyn
 *
 * scope_intro.cpp — Exhibit Introduction display.
 * Text-only: fills the full window with the welcome description.
 */

#include "scope_intro.h"
#include <glad/glad.h>

bool ScopeIntro::init(const std::string& /*shaderDir*/) {
    panel_.setLines({
        "WELCOME TO THE MUSEUM VINTAGE RADAR EXHIBIT",
        "",
        "Welcome! This exhibit lets you experience how radar worked",
        "from the 1940s through the 1960s -- technology that changed",
        "the course of World War 2 and shaped modern aviation and",
        "maritime safety.",
        "",
        "Radar works by sending out short bursts of radio energy and",
        "listening for the echo that bounces back from ships, aircraft,",
        "and terrain. By measuring the time it takes for the echo to",
        "return, the radar calculates how far away the object is.",
        "Rotating the antenna builds a map of everything around it.",
        "",
        "This exhibit features radar displays. Explore each one at",
        "your own pace.",
        "",
        "Press s at any time to jump to the next display.",
        "Press S (shift+s) to go back.",
        "Any key press resets the 120-second auto-advance timer.",
        "",
        "  Next: Marine PPI -->",
        "",
        "+-------+-----------------------+",
        "| KEY   | FUNCTION              |",
        "+-------+-----------------------+",
        "|  s    | Next display          |",
        "|  S    | Previous display      |",
        "+-------+-----------------------+",
    });
    return true;
}

void ScopeIntro::render(float /*dt*/, float viewportW, float viewportH) {
    glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
    glClear(GL_COLOR_BUFFER_BIT);
    panel_.render(viewportW, viewportH, viewportW, viewportH);
}

void ScopeIntro::handleKey(int /*key*/, int /*scancode*/,
                            int /*action*/, int /*mods*/) {
    // All navigation handled by ScopeManager; nothing scope-specific here.
}
