#pragma once
#include "../../include/asset_mgr.hpp"
#include <PSX/GPU/make_gpu_primitives.hpp>
#include <PSX/Timer/frame_timer.hpp>

namespace object {
    using namespace JabyEngine;

    class Paco {
    private:
        static constexpr auto Size = Make::SizeI16(120, 128);
        static const GPU::Color24 Colors[];

        GPU::TexPage::Linked tex_page;
        GPU::SPRT::Linked    sprite;
        SimpleTimer<uint8_t> timer;
        uint8_t              color_idx;

    public:
        constexpr Paco() : 
            tex_page(Make::TexPage(Make::PositionU16(
                Assets::Main::PacoTIM.get_texture_x(), Assets::Main::PacoTIM.get_texture_y()), 
                GPU::TextureColorMode::clut4).linked()),
            sprite(Make::SPRT(
                Make::AreaI16(Make::PositionI16(GPU::Display::Width - Size.width, GPU::Display::Height - Size.height), Size),
                Make::OffsetPageWithClut(Make::PageOffset(0, 0), Make::PageClut(Assets::Main::PacoTIM.get_clut_x(), Assets::Main::PacoTIM.get_clut_y())),
                GPU::Color24::Blue()).linked()),
            timer(),
            color_idx(0) {}

            void setup();
            void update();
            void render();
    };
}