#define DRAW_SCREEN 1

#include <Containers.h>
#include <log.h>
#include <SFML/Graphics.hpp>
#include <imgui-SFML.h>
#include <imgui.h>

#include <Entities.h>
#include <utility.h>

int main(int argc, char* argv[])
{
	LOG("\n\n\033[32mTODO: ");
	LOG("\033[0m");

	EntityManager em;
	auto x = em.getEntities(Tag::enemy);
	
#if DRAW_SCREEN == 1
	auto window = sf::RenderWindow(sf::VideoMode({ 1920u, 1080u }), "2d-platformer");
	window.setFramerateLimit(60);
	if (!ImGui::SFML::Init(window))
		return -1;

	sf::Clock clock; 
	while (window.isOpen())
	{
		while (const std::optional event = window.pollEvent())
		{
			ImGui::SFML::ProcessEvent(window, *event);

			if (event->is<sf::Event::Closed>())
			{
				window.close();
			}

			if (const auto* keyPressed = event->getIf<sf::Event::KeyPressed>())
			{
				if (keyPressed->scancode == sf::Keyboard::Scan::Escape)
				{
					window.close();
				}
			}

		}// end user input loop

		ImGui::SFML::Update(window, clock.restart());

		ImGui::Begin("sdfkjasbdf");
		ImGui::End();
		window.clear();
		ImGui::SFML::Render(window);
		
		window.display();
		
	}

	ImGui::SFML::Shutdown();
#endif
}