#pragma once

#define cimg_display 0
#include <CImg.h>

#include <glm/glm.hpp>

#include <string>

/*
 * prototype: framebuffer
 * void set_pixel(glm::vec<4, int> pos, glm::vec<3, unsigned char> color);
 *
 */

namespace gb
{
    class cimg_framebuffer
    {
    public:
        explicit cimg_framebuffer(const char* filename, unsigned int x, unsigned int y);
        ~cimg_framebuffer(void);
        void set_pixel(const glm::vec<4, int>& pos, const glm::vec<3, unsigned char>& color);
        unsigned int dimx(void) const;
        unsigned int dimy(void) const;

    private:
        void save_image(void) const;

    private:
        explicit cimg_framebuffer(const cimg_framebuffer&);

    private:
        std::string m_filename;

        cimg_library::CImg<unsigned char> m_image;

        unsigned int m_dimx;
        unsigned int m_dimy;
    };
}
