#pragma once
#include "Level.h"
#include "Texture.h"
#include "WorldLevel.h"
#include "WorldTile.h"
#include <array>

#include "Collision.h"
#include "Player.h"
#include "utils.h"


class WorldLevel : public Level {
public:
	static const int WORLD_WIDTH = 34;
	static const int WORLD_HEIGHT = 34;

	static const int TILE_WIDTH = 50;
	static const int TILE_HEIGHT = 50;

	WorldLevel(Camera* camera, Rectf viewport);
	~WorldLevel() override;

	void Update(float elapsedSec) override;
	void Draw() const override;

	void MouseMove(const Point2f& mousePos) override;
	void ProcessImGui() override;

	WorldTile* GetTileAt(const Point2f& pos) const;
	void SetTileAt(const Point2f& pos, WorldTile* tile);

	std::array<std::array<WorldTile*, WORLD_WIDTH>, WORLD_HEIGHT> GetAllTiles() const;

	std::vector<Collision::CollisionRect> m_Rects;

	std::array<std::array<WorldTile*, WORLD_WIDTH>, WORLD_HEIGHT> GetWorldTiles() const { return m_worldTiles; }

	

private:

	
	std::array<std::array<WorldTile*, WORLD_WIDTH>, WORLD_HEIGHT> m_worldTiles;

	Player m_player;
	Point2f m_mousePos{};

	Rectf m_viewport;

	// ImGui Vars
	bool m_ShowTextureManagerWindow{ false };
	bool m_ShowCameraWindow{ false };
	bool m_ShowPlayerInfo{ false };
};
