aboutsummaryrefslogtreecommitdiff
path: root/src/glfw.c
blob: 8afdfe46e1dc7e5da1fef788ea87fc5cf0e618d3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
/* ************************************************************************** */
/*                                                                            */
/*                                                        :::      ::::::::   */
/*   glfw.c                                             :+:      :+:    :+:   */
/*                                                    +:+ +:+         +:+     */
/*   By: charles <charles.cabergs@gmail.com>        +#+  +:+       +#+        */
/*                                                +#+#+#+#+#+   +#+           */
/*   Created: 2020/05/11 01:58:00 by charles           #+#    #+#             */
/*   Updated: 2020/05/11 02:16:58 by charles          ###   ########.fr       */
/*                                                                            */
/* ************************************************************************** */

#include "scop.h"

GLFWwindow	*glfw_init(int width, int height)
{
	GLFWwindow	*window;

	if (!glfwInit())
		return (NULL);
	window = glfwCreateWindow(width, height, "scop", NULL, NULL);
	if (window == NULL)
	{
		glfwTerminate();
		return (NULL);
	}
	glfwMakeContextCurrent(window);
	glewInit();
	return (window);
}