#include "Launcher.hpp"
#include "Core.hpp"
#include "Asset.hpp"
#include "Log.hpp"

std::unordered_map<std::string, sf::Texture> Asset::s_tex;
std::unordered_map<std::string, sf::SoundBuffer> Asset::s_snd;
std::unordered_map<std::string, sf::Font> Asset::s_fnt;

Launcher::Launcher():
m_running(true),
m_highScore(0) {
	m_window.create(sf::VideoMode(640, 360), "That Time I Crossed A Barren Desert - LD 46 - Keep it Alive", sf::Style::Titlebar | sf::Style::Close, ContextSettings(0, 0, 0, 2, 0));
    //m_window.setPosition(sf::Vector2i(0, 0));
	m_window.setFramerateLimit(240);
	m_window.setSize({1280, 720});
	m_window.setKeyRepeatEnabled(false);
}

void Launcher::launch() {
	Log(INFO, "Launching.");
	while(m_running) {
		Core core(&m_window);
		core.run();
		m_highScore = core.getScore();
		m_running = core.hasQuit();
	}
	Log(INFO, "Fin.");
}
