/*
PolyGun

Copyright (c) 2023 kacperks https://kacperks.cubesoftware.xyz

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/

#ifndef POLYGUN_ENGINE_HPP
#define POLYGUN_ENGINE_HPP

#include "game/engine/screen_manager.hpp"
#include "game/gui/gui_master.hpp"
#include "game/renderer/master_renderer.hpp"

namespace polygun::window {
	class Window;
}

namespace polygun::engine {
	struct DirectJoinArguments {
		std::string m_nickname;
		std::string m_ip;
		unsigned short m_port;
		bool m_host_server;
	};

	class Engine {
	private:
		ScreenManager m_screen_manager;
		window::Window* m_window;
		renderer::MasterRenderer* m_master_renderer;
		gui::GUIMaster m_gui;

	public:
		Engine();
		~Engine() = default;

		void init(DirectJoinArguments* direct_join);
		void render();
		void update();

		ScreenManager& get_screen_manager() { return m_screen_manager; }
		window::Window* get_window() { return m_window; }
		renderer::MasterRenderer* get_master_renderer() { return m_master_renderer; }
		renderer::MeshRenderer* get_mesh_renderer() { return m_master_renderer->get_mesh_renderer(); }
		renderer::GUIRenderer* get_gui_renderer() { return m_master_renderer->get_gui_renderer(); }
		gui::GUIMaster& get_gui_master() { return m_gui; }

		static unsigned get_screen_width();
		static unsigned get_screen_height();
	};

}
#endif // POLYGUN_ENGINE_HPP
