/* This file is part of RetroFE.
 *
 * RetroFE is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * RetroFE is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with RetroFE.  If not, see <http://www.gnu.org/licenses/>.
 */
#pragma once
#include "Component.h"
#include "../../Collection/Item.h"
#include <SDL2/SDL.h>
#include <vector>
#include <string>


class ReloadableScrollingText : public Component
{
public:
    ReloadableScrollingText(Configuration &config, bool systemMode, bool layoutMode, std::string type, std::string textFormat, std::string alignment, Page &page, int displayOffset, Font *font, float scaleX, float scaleY, std::string direction, float scrollingSpeed, float startPosition, float startTime, float endTime );
    virtual ~ReloadableScrollingText( );
    void     update(float dt);
    void     draw( );
    void     freeGraphicsMemory( );

private:
    void reloadTexture( );
    void loadText( std::string collection, std::string type, std::string basename, bool systemMode );
    Configuration           &config_;
    bool                     systemMode_;
    bool                     layoutMode_;
    Font                    *fontInst_;
    std::string              type_;
    std::string              textFormat_;
    std::string              alignment_;
    std::vector<std::string> text_;
    float                    scaleX_;
    float                    scaleY_;
    std::string              direction_;
    float                    scrollingSpeed_;
    float                    startPosition_;
    float                    currentPosition_;
    float                    startTime_;
    float                    waitStartTime_;
    float                    endTime_;
    float                    waitEndTime_;
    std::string              currentCollection_;
    Page                    *page_;
    int                      displayOffset_;
};
