#include <deerith/core/log.h>

#include "detail/graphics.h"

namespace deerith {
	void graphics::init_glfw() {
		deerith_graphics_trace("Initializing glfw");

		glfwInit();

		glfwWindowHint(GLFW_CLIENT_API, GLFW_NO_API);
		glfwWindowHint(GLFW_RESIZABLE, GLFW_FALSE);

		window = glfwCreateWindow(graphics_config.window_width, graphics_config.window_height, graphics_config.window_title, nullptr, nullptr);

		if (!window) {
			deerith_graphics_error("failed to init glfw window");
		}
	}

	void graphics::shutdown_glfw() {
		deerith_graphics_trace("Shutting down glfw");

		glfwDestroyWindow(window);
		glfwTerminate();
	}
} // namespace deerith