#include "window.h"

#include <stdlib.h>

#include "gl.h"

struct window *sw_window_create(struct vec2i size, char *title) {
	struct window *win;

	win = malloc(sizeof(struct window));
	win->size = size;

	glfwInit();
	glfwDefaultWindowHints();

	win->_window = glfwCreateWindow(size.x, size.y, title, 0, 0);
	glfwShowWindow(win->_window);
	glfwMakeContextCurrent(win->_window);
	glewInit();
	glfwSwapInterval(1);
	glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
	glEnable(GL_BLEND);
	glEnable(GL_DEPTH_TEST);

	return win;
}
