/*
 * This file is part of FGGL.
 *
 * FGGL is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any
 * later version.
 *
 * FGGL 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 Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License along with FGGL.
 * If not, see <https://www.gnu.org/licenses/>.
 */

//
// Created by webpigeon on 10/12/22.
//

#ifndef FGGL_DEMO_INCLUDE_HEXBOARD_SCENE_H
#define FGGL_DEMO_INCLUDE_HEXBOARD_SCENE_H

#include <memory>
#include <optional>

#include "fggl/scenes/game.hpp"
#include "fggl/grid/hexgrid.hpp"
#include "fggl/grid/layout.hpp"

namespace demo::hexboard {

	struct SelectionModel {
		std::optional<fggl::grid::IntHex> selected;
		std::optional<fggl::grid::IntHex> hover;
	};

	class Scene : public fggl::scenes::GameBase {
		public:
			explicit Scene(fggl::App& app);

			void activate() override;
			void deactivate() override;

			void update(float delta) override;
			void render(fggl::gfx::Graphics& gfx) override;

		private:
			std::unique_ptr<fggl::grid::HexGrid> m_board;
			std::unique_ptr<fggl::grid::Layout> m_layout;
			std::unique_ptr<SelectionModel> m_selections;

			void drawGrid(fggl::gfx::Paint&);
			void drawSelections(fggl::gfx::Paint&);
	};

} // namespace demo::hexboard

#endif //FGGL_DEMO_INCLUDE_HEXBOARD_SCENE_H