#pragma once
#include "DangerousRacers/Label.h"
#include "DangerousRacers/Meter.h"
#include "DangerousRacers/Player.h"
#include "DangerousRacers/Scene.h"
#include "DangerousRacers/Obstacles/ObstacleManager.h"
#include "SFML/Graphics/Texture.hpp"
#include "SFML/Graphics/Sprite.hpp"

class TutorialLevelScene : public Scene {
    sf::Texture backgroundTexture;
    sf::Sprite backgroundSprite;

    float speed = 200.f;
    float bgYOffset = -720.f;

    float distanceTraveled = 0.f;

    Player player{405.f/2, 720.f/2};
    ObstacleManager obstacleManager{speed};

    bool reverseTime = false;
    float timeInReverse = 0.f;

    Label scoreLabel{"KM: 0", {8,8}, false, true};

    float fuel = 1.f, health = 1.f;

    Meter fuelMeter{ 8, 712, 16.f, 320.f, {175, 198, 151} };
    Meter damageMeter{ 8, 384, 16.f, 320.f, {250,231,19} };

    unsigned char currentTutorial = 0;
    const std::vector<float> tutorialDistance { 1750.f, 3250.f, 4750.f };
    std::vector<Label> tutorialLabels {
        { "Move your mouse\nto avoid obstacles", sf::Vector2f(405.f/2, 720.f*0.25f), true },
        { "This is your fuel\nIf it runs out, gameover", sf::Vector2f(32, 600), false },
        { "This is your damage\nToo much damage, kaboom", sf::Vector2f(32, 200), false },
    };
public:
    TutorialLevelScene(SceneManager& _sceneManager);

    void start();
    void reset();

    void leave();

    void update(float deltaTime);

    void render(sf::RenderWindow& window);

    void eventHandler(sf::Event& event);
};
