/******************************************************************************
*	File		-	map_canvas.h
*	Author		-	Joey Pollack
*	Date		-	2022/02/14 (y/m/d)
*	Mod Date	-	2022/02/14 (y/m/d)
*	Description	-	the canvas panel for painting map tiles
******************************************************************************/

#ifndef MAP_CANVAS_H_
#define MAP_CANVAS_H_

#include <gui/panel.h>
#include <editor/project/contents/tile_map.h>
#include <core/types.h>
#include <string>

namespace lunarium { class Image; class IGraphics; }

namespace lunarium { namespace editor
{
    class MapEditor;

    class MapCanvas : public gui::Panel
    {
    public:
        MapCanvas(MapEditor* editor);
        void Update(float delta);
        bool DoFrame();

        void SetTileMap(TileMap* pMap);

        void SetSelectedTile(TileRef tile);
        TileRef GetSelectedTile() const;

        // Force the image to redraw and recreate the frame buffer
        void MapSizeChanged();
        // void Invalidate();

    private:
        MapEditor* mpMapEditor;
        std::string mMouseStatusInfo;
        int mFrameBuffer;
        Image* mpCanvasImage;
        TileMap* mMap;
        TileRef mSelectedTile;
        bool mMapSizeChanged;

    private:    

    };
}}

#endif  // MAP_CANVAS_H_